Skip to content

Commit 1819c88

Browse files
committed
Adds N shortcut to open inline card form
Adds press N shortcut tip
1 parent 39fcd94 commit 1819c88

File tree

7 files changed

+18
-3
lines changed

7 files changed

+18
-3
lines changed

app/javascript/controllers/grouping_column_controller.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ export default class extends Controller {
3333
closeForm() {
3434
this.hideInlineCardForm();
3535
}
36+
37+
nWasPressed(e) {
38+
if (document.activeElement == document.body && this.element.matches(':hover')) {
39+
e.preventDefault()
40+
this.showInlineCardForm()
41+
}
42+
}
3643
}

app/views/groupings/issues/_form.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<div data-resizable-input-target="replica" class=" text-base p-2 whitespace-pre-line"></div>
2929

3030
<%= f.text_area :title, required: true,
31+
autocomplete: 'off',
3132
autofocus: true,
3233
class: "text-base p-2 input-primary absolute w-full left-0 top-0 right-0 bottom-0 overflow-y-hidden",
3334
"data-resizable-input-target": "input"

app/views/visualizations/_column.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<li class="w-64 max-h-full flex flex-col shrink-0 p-2 border bg-body-contrast border-background-100 rounded-md shadow-xs snap-center cpy-grouping js-sortable-container"
22
id="<%= dom_id(grouping) %>"
33
data-controller="grouping-column"
4+
data-action="keypress.n@window->grouping-column#nWasPressed"
45
>
56
<header class="flex flex-row flex-nowrap gap-x-1 mb-4 px-2 relative" data-controller="dropdown">
67
<%= link_to edit_visualization_grouping_path(grouping.visualization_id, grouping.id), class: "grow font-semibold truncate text-readable-content-500 hover:text-readable-content-700", data: { turbo_frame: 'grouping_form' } do %>
@@ -56,12 +57,13 @@
5657
</ul>
5758

5859
<%= render partial: 'visualizations/_column/inline_card_form', locals: { grouping: } %>
59-
<button class="cpy-inline-create-button flex flex-row items-center mt-4 p-2 hover:bg-background-100 rounded-md"
60+
<button class="cpy-inline-create-button group flex flex-row items-center mt-4 p-2 hover:bg-background-100 rounded-md"
6061
data-grouping-column-target="showFormButton"
6162
data-action="click->grouping-column#showInlineCardForm">
6263
<i class="fa-solid fa-plus mr-2"></i>
6364
<p class="grow text-left">
6465
<%= t('visualizations.column_menu.create_issue') %>
6566
</p>
67+
<span class="group-hover:flex hidden text-xs font-medium ml-2"><%= t("actions.press") %> N</span>
6668
</button>
6769
</li>

app/views/visualizations/_column/_inline_card_form.html.erb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
}) do |f| %>
1010

1111
<div class="mb-2 w-full">
12-
<%= f.text_field :title, required: true, class: "border-2 border-primary-500 focus:border-primary-500 active:border-primary-500 hover:border-primary-500 bg-primary-50 p-4 rounded-xl text-sm w-full text-sm text-readable-content-500", id: nil %>
12+
<%= f.text_field :title,
13+
autocomplete: 'off',
14+
required: true,
15+
class: "border-2 border-primary-500 focus:border-primary-500 active:border-primary-500 hover:border-primary-500 bg-primary-50 p-4 rounded-xl text-sm w-full text-sm text-readable-content-500", id: nil %>
1316
</div>
1417

1518
<div class="flex gap-2 items-stretch ">

app/views/visualizations/groupings/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212
</div>
1313
<div class="space-y-4">
14-
<%= form_for([visualization, grouping], html: { class: 'flex flex-col gap-2' }) do |f| %>
14+
<%= form_for([visualization, grouping], html: { autocomplete: 'off', class: 'flex flex-col gap-2' }) do |f| %>
1515
<% if grouping.errors.any? %>
1616
<div class="flex rounded-md w-full border-l-6 border-alert-500 bg-alert-500 bg-opacity-[15%] px-4 py-1 mb-5 shadow-sm md:p-4 text-sm text-alert-500">
1717
<%= grouping.errors.full_messages.to_sentence.capitalize %>

config/locales/app.en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ en:
5252
filter: "Filter"
5353
clear_filter: "clear filter"
5454
preview: "Preview"
55+
press: "Press"
5556
flash:
5657
change_success: "Change successfully made."
5758
change_error: "Change could not be made."

config/locales/app.pt-BR.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pt-BR:
5353
filter: "Filtrar"
5454
clear_filter: "Limpar filtro"
5555
preview: "Pré-visualização"
56+
press: "Pressione"
5657
flash:
5758
change_success: "Alteração feita com sucesso."
5859
change_error: "Houve um erro na hora de realizar a alteração."

0 commit comments

Comments
 (0)