diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 9e7d03037..6d5e355b0 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -19,6 +19,10 @@ "Bash(bundle exec rails routes:*)", "Bash(bundle exec rubocop:*)", "Bash(git -C /Users/maebeale/programming/awbw diff --name-only main...HEAD)", + + "Bash(ruby:*)", + "Bash(bundle install:*)" + "Bash(git merge:*)" ] } diff --git a/app/helpers/taggings_helper.rb b/app/helpers/taggings_helper.rb index d6dbe3ac0..3bfe155df 100644 --- a/app/helpers/taggings_helper.rb +++ b/app/helpers/taggings_helper.rb @@ -14,4 +14,24 @@ def tagged_index_path(type, sector_names_all:, category_names_all:) polymorphic_path(klass, params) end + + # Collects all tags (sectors and categories) for a resource + # Returns an array of tag names sorted appropriately + def collect_all_tags(resource) + all_tags = [] + + if resource.respond_to?(:sectors) && resource.sectors.any? + all_tags += resource.sectors + .sort_by { |s| s.name.to_s.downcase } + .map(&:name) + end + + if resource.respond_to?(:categories) && resource.categories.any? + all_tags += resource.categories + .sort_by { |c| [ c.position.to_i, c.name.to_s.downcase ] } + .map(&:name) + end + + all_tags + end end diff --git a/app/views/bookmarks/_personal_row.html.erb b/app/views/bookmarks/_personal_row.html.erb index 3df16c592..144bd4bd8 100644 --- a/app/views/bookmarks/_personal_row.html.erb +++ b/app/views/bookmarks/_personal_row.html.erb @@ -47,9 +47,9 @@ You bookmarked on <%= bookmark.created_at.strftime("%B %d, %Y") %> + <% tag_list = bookmark.bookmarkable_type == "Workshop" ? collect_all_tags(bookmarkable) : [] %>
- Bookmarked by community - <%= bookmark.bookmarkable.bookmarks_count %> times + Bookmarked by community <%= bookmark.bookmarkable.bookmarks_count %> times<% if tag_list.any? %>, Tags: <%= tag_list.count %><% end %>
diff --git a/app/views/bookmarks/update.turbo_stream.erb b/app/views/bookmarks/update.turbo_stream.erb index a174b67d5..7a1744cad 100644 --- a/app/views/bookmarks/update.turbo_stream.erb +++ b/app/views/bookmarks/update.turbo_stream.erb @@ -1,11 +1,7 @@ <%= turbo_stream.replace dom_id(@bookmarkable, :bookmark_icon), partial: "editable_bookmark_icon", locals: {resource: @bookmarkable} %> <%= turbo_stream.replace dom_id(@bookmarkable, :bookmark_button), partial: "editable_bookmark_button", locals: {resource: @bookmarkable} %> -<%= turbo_stream.update dom_id(@bookmarkable, :bookmark_count) do %> - Bookmarked: - <%= @bookmarkable.bookmarks_count %> - <%= "time".pluralize(@bookmarkable.bookmarks_count) %> -<% end %> +<%= turbo_stream.update dom_id(@bookmarkable, :bookmark_count) do %>Bookmarked: <%= @bookmarkable.bookmarks_count %> <%= "time".pluralize(@bookmarkable.bookmarks_count) %><% end %> <%= turbo_stream.update dom_id(@bookmarkable, :bookmark_count_person) do %> (Bookmarked by diff --git a/app/views/workshops/_index_row.html.erb b/app/views/workshops/_index_row.html.erb index 0273bfe5c..b51472676 100644 --- a/app/views/workshops/_index_row.html.erb +++ b/app/views/workshops/_index_row.html.erb @@ -64,11 +64,11 @@ | <%= workshop.date %> - - <%= tag.div id: dom_id(workshop, :bookmark_count), - class: "text-sm text-gray-600 leading-tight" do %> - Bookmarked: <%= workshop.bookmarks_count %> <%= "time".pluralize(workshop.bookmarks_count.to_i) %> - <% end %> + + <% tag_list = hide_tags ? [] : collect_all_tags(workshop) %> +
+ Bookmarked: <%= workshop.bookmarks_count %> <%= "time".pluralize(workshop.bookmarks_count.to_i) %><% if tag_list.any? %>, Tags: <%= tag_list.count %><% end %> +
<%#= tag.div id: dom_id(workshop, :led_count), @@ -110,19 +110,7 @@

- <% unless hide_tags %> - <% if workshop.categories.any? %> - <% ordered_tags = workshop.categories - .sort_by { |c| [c.position.to_i, c.name.to_s.downcase] } - .map(&:name) - .to_sentence %> -

- Tags: - - <%= ordered_tags.truncate(150) %> -

- <% end %> - <% end %> +