Merge pull request #1713 from basecamp/put-tags-the-card-is-tagged-with-first
Show tags the card is tagged with first
This commit is contained in:
@@ -2,7 +2,8 @@ class Cards::TaggingsController < ApplicationController
|
||||
include CardScoped
|
||||
|
||||
def new
|
||||
@tags = Current.account.tags.all.alphabetically
|
||||
@tagged_with = @card.tags.alphabetically
|
||||
@tags = Current.account.tags.all.alphabetically.where.not(id: @tagged_with)
|
||||
fresh_when etag: [ @tags, @card.tags ]
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<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,
|
||||
class: "popup__btn btn",
|
||||
form_class: "max-width flex-item-grow" do %>
|
||||
<span class="overflow-ellipsis flex-item-grow"><%= tag.hashtag %></span>
|
||||
<%= icon_tag "check", size: 18, class: "checked flex-item-no-shrink flex-item-justify-end", style: "--icon-size: 1em" %>
|
||||
<% end %>
|
||||
</li>
|
||||
@@ -18,16 +18,8 @@
|
||||
<% end %>
|
||||
|
||||
<ul class="popup__list" data-filter-target="list">
|
||||
<% @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,
|
||||
class: "popup__btn btn",
|
||||
form_class: "max-width flex-item-grow" do %>
|
||||
<span class="overflow-ellipsis flex-item-grow"><%= tag.hashtag %></span>
|
||||
<%= icon_tag "check", size: 18, class: "checked flex-item-no-shrink flex-item-justify-end", style: "--icon-size: 1em" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<%= render collection: @tagged_with, partial: "tag", locals: { card: @card } %>
|
||||
<%= render collection: @tags, partial: "tag", locals: { card: @card } %>
|
||||
|
||||
<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 %>
|
||||
|
||||
Reference in New Issue
Block a user