From 38faf6cb95dba49018f1dcc9538ab59466183d94 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 14 Nov 2024 15:10:47 -0600 Subject: [PATCH] Rework tagging UI to use new menu lisdt --- app/assets/stylesheets/tags.css | 21 +++++++++++++++++++++ app/views/bubbles/_tags.html.erb | 10 +--------- app/views/bubbles/show.html.erb | 29 ++++++++++++++++++++++++++++- app/views/tags/new.html.erb | 12 ------------ 4 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 app/assets/stylesheets/tags.css delete mode 100644 app/views/tags/new.html.erb diff --git a/app/assets/stylesheets/tags.css b/app/assets/stylesheets/tags.css new file mode 100644 index 000000000..ad5ced7fa --- /dev/null +++ b/app/assets/stylesheets/tags.css @@ -0,0 +1,21 @@ +.tag-picker { + --panel-border-radius: 2em; + --panel-padding: 0.5em 0.7em; + --panel-size: max-content; + + inline-size: auto !important; + inset: 0 auto auto 0; + max-inline-size: var(--panel-size) !important; + position: absolute; + z-index: 2; + + &[open] { + display: flex; + } + + .input { + --input-padding: 0.2em 0.5em; + + inline-size: 18ch; + } +} diff --git a/app/views/bubbles/_tags.html.erb b/app/views/bubbles/_tags.html.erb index bb0a4788f..f802d3d8f 100644 --- a/app/views/bubbles/_tags.html.erb +++ b/app/views/bubbles/_tags.html.erb @@ -1,11 +1,3 @@ -<% bubble.tags.each do |tag| %> +<% bubble.tags.last(3).each do |tag| %> <%= link_to tag.hashtag, bubbles_path(bucket_id: bubble.bucket, tag_ids: tag), class: "bubble__bubble bubble__meta bubble__tag" %> <% end %> - -<% if bubble.tags.size < 3 %> - -<% end %> diff --git a/app/views/bubbles/show.html.erb b/app/views/bubbles/show.html.erb index 903bf1152..f68a66565 100644 --- a/app/views/bubbles/show.html.erb +++ b/app/views/bubbles/show.html.erb @@ -35,8 +35,35 @@ <% end %> +
+ + + + <%= image_tag "tag.svg", aria: { hidden: true }, size: 24 %> + + <%= form_with model: Tag.new, url: bucket_bubble_tags_path(@bubble.bucket, @bubble), class: "min-width flex-item-grow", data: { turbo_frame: "_top" } do |form| %> + <%= form.text_field :title, class: "input", autofocus: "on", list: "tags-list" %> + <%= form.submit "Create Tag", hidden: true %> + + + <%= Current.account.tags.each do |tag| %> + + <% end %> + + <% end %> + +
+ +
+
+
- <%= bubble_action_button('new-tag', 'tag', 'Tag this') %> <%= bubble_action_button('new-attachment', 'picture-add', 'Attach a file') %> <%= bubble_action_button('new-boost', 'thumb-up', 'Boost this') %> diff --git a/app/views/tags/new.html.erb b/app/views/tags/new.html.erb deleted file mode 100644 index 4199436e5..000000000 --- a/app/views/tags/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%= turbo_frame_tag :new_tag do %> - <%= form_with model: Tag.new, url: bucket_bubble_tags_path(@bubble.bucket, @bubble), data: { turbo_frame: "_top" } do |form| %> - <%= form.text_field :title, class: "input borderless", autofocus: "on", list: "tags-list" %> - <%= form.submit "Create Tag", hidden: true %> - - - <%= Current.account.tags.each do |tag| %> - - <% end %> - - <% end %> -<% end %>