Hotkey to open tags, focus field, move add to bottom
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="position-relative" data-controller="dialog"
|
||||
data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside" <%= "hidden" if card.closed? %>>
|
||||
<button class="tag-picker__button btn card__hide-on-index" style="--btn-background: var(--card-bg-color);"
|
||||
data-controller="tooltip" data-action="click->dialog#open:stop">
|
||||
data-controller="tooltip hotkey" data-action="click->dialog#open:stop keydown.t@document->hotkey#click">
|
||||
<%= icon_tag "tag" %>
|
||||
<span class="for-screen-reader">Add a tag</span>
|
||||
</button>
|
||||
|
||||
@@ -5,24 +5,19 @@
|
||||
data-navigable-list-actionable-items-value="true"
|
||||
data-action="keydown->navigable-list#navigate filter:changed->navigable-list#reset dialog:show@document->navigable-list#reset"
|
||||
>
|
||||
<strong class="popup__title">Tag this…</strong>
|
||||
<div class="flex justify-space-between">
|
||||
<strong class="popup__title">Tag this…</strong><kbd class="txt-x-small hide-on-touch">t</kbd>
|
||||
</div>
|
||||
|
||||
<%= form_with url: card_taggings_path(@card),
|
||||
id: dom_id(@card, :tags_form),
|
||||
data: { controller: "form", action: "submit->form#preventEmptySubmit" },
|
||||
class: "flex flex-column gap-half full-width margin-block-half" do |form| %>
|
||||
<%= form.text_field :tag_title, placeholder: @tags.any? ? "Add a new tag or filter…" : "Name this tag…", class: "input txt-small full-width",
|
||||
autocomplete: "off", data: { filter_target: "input", form_target: "input", action: "input->filter#filter" } %>
|
||||
autocomplete: "off", autofocus: true, data: { filter_target: "input", form_target: "input", action: "input->filter#filter" } %>
|
||||
<% end %>
|
||||
|
||||
<ul class="popup__list" data-filter-target="list">
|
||||
<li class="popup__item" data-navigable-list-target="item">
|
||||
<%= button_tag "Create a new tag", type: "submit", form: dom_id(@card, :tags_form), class: "btn popup__btn", data: { form_target: "submit" } do %>
|
||||
<%= icon_tag "add" %>
|
||||
<span>Create tag</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<% @tags.each do |tag| %>
|
||||
<li class="popup__item" data-filter-target="item" data-navigable-list-target="item" aria-checked="<%= @card.tagged_with?(tag) %>">
|
||||
<%= button_to card_taggings_path(@card, params: { tag_title: tag.title }), method: :post,
|
||||
@@ -33,6 +28,13 @@
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li class="popup__item" data-navigable-list-target="item">
|
||||
<%= button_tag "Create a new tag", type: "submit", form: dom_id(@card, :tags_form), class: "btn popup__btn", data: { form_target: "submit" } do %>
|
||||
<%= icon_tag "add" %>
|
||||
<span>Create tag</span>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user