Remove duplication for tags

This commit is contained in:
Jorge Manrubia
2025-04-04 17:27:36 +02:00
parent 77e9e4b05f
commit a41ee80e91
2 changed files with 8 additions and 31 deletions
+1 -22
View File
@@ -1,22 +1 @@
<%= turbo_frame_tag bubble, :tags do %>
<div class="card__tags flex align-center flex-item-grow min-width">
<div class="overflow-ellipsis">
<% if bubble.tags.any? || bubble.creating? %>
<span># </span>
<% bubble.tags.each_with_index do |tag, index| %>
<%= link_to bubbles_path(bucket_ids: [ bubble.bucket ], tag_ids: [ tag.id ]),
class: "card__tag btn btn--plain min-width txt-uppercase fill-transparent", data: { turbo_frame: "_top" } do %>
<span class="overflow-ellipsis"><%= tag.title %></span>
<% end %><%= ", " unless index == bubble.tags.size - 1 %>
<% end %>
<% end %>
</div>
<div class="position-relative" data-controller="dialog" data-action="keydown.esc->dialog#close click@document->dialog#closeOnClickOutside">
<button class="tag-picker__button btn card__hide-on-index <%= bubble.creating? || bubble.drafted? ? "fill-highlight" : "fill-transparent" %>" data-action="click->dialog#open:stop">
<%= icon_tag "tag" %>
<span class="for-screen-reader">Add a tag</span>
</button>
</div>
</div>
<% end %>
<%= render "bubbles/cards/preview/tags", bubble: bubble %>
@@ -1,14 +1,12 @@
<%= turbo_frame_tag bubble, :tags do %>
<div class="card__tags flex align-center flex-item-grow min-width">
<div class="overflow-ellipsis">
<% if bubble.tags.any? || bubble.creating? %>
<span># </span>
<% bubble.tags.each_with_index do |tag, index| %>
<div class="card__tags flex align-center flex-item-grow min-width">
<div class="overflow-ellipsis">
<% if bubble.tags.any? %>
<span># </span>
<% bubble.tags.each_with_index do |tag, index| %>
<span class="card__tag btn btn--plain min-width txt-uppercase fill-transparent overflow-ellipsis">
<%= tag.title %>
</span>
<% end %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>