Skip to content

Surface hidden (unpublished) sector & category tags to admins#1708

Merged
maebeale merged 1 commit into
mainfrom
maebeale/tags-hidden-icon-chips
Jun 17, 2026
Merged

Surface hidden (unpublished) sector & category tags to admins#1708
maebeale merged 1 commit into
mainfrom
maebeale/tags-hidden-icon-chips

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

Closes [link an issue or remove this line]

What is the goal of this PR and why is this important?

  • Admins browse the same /tags and taggings pages as the public, but had no way to tell which tags are hidden from the public (unpublished).
  • This surfaces unpublished sector and category chips to admins with a clear visual cue, so they can spot at a glance what visitors can't see — and jump straight to editing it.

How did you approach the change?

  • Render unpublished sector/category chips as a muted grey chip with a closed-eye icon (shared/_hidden_tag_icon) — the same "hidden" glyph used by the password-visibility toggle on login. The grey treatment wins even when an explicit bg_color is passed.
  • Chips stay admin-only via the existing :taggable policy scope (has_taggings for admins, published.has_published_taggings for everyone else) — the public never sees hidden tags.
  • Added Edit sector / Edit category admin shortcuts on the filtered taggings header (named per-tag when filtering by more than one).
  • Added a Sector.sector_names_all scope mirroring Category.category_names_all so the header can resolve the active filter to records.
  • Seeded a few unpublished sectors and categories that carry taggings in the dev sample data (db/seeds/dev/workshops.rb) so the hidden state is exercised locally. Base db/seeds.rb remains the canonical list only.

UI Testing Checklist

  • As an admin, visit /tags — unpublished sectors/categories appear as grey chips with a closed-eye icon, sized inline at normal chip height.
  • As a logged-out / non-admin user, those hidden chips do not appear.
  • Filter the taggings page by a hidden sector/category — the Edit shortcut appears for admins only.

Anything else to add?

  • Dev data only; production seeds (db:seed) stay canonical-only.
  • Note for reviewer: screenshots to be added.

Admins browse the same tags pages as the public, but had no way to tell at
a glance which tags the public can't see. Render unpublished sector and
category chips as a muted grey chip with a closed-eye icon (the same "hidden"
cue used by the password-visibility toggle) so the hidden-from-public state
reads instantly. The chips stay admin-only via the existing :taggable policy
scope; the public never sees them.

Also adds admin "Edit sector/category" shortcuts on the filtered taggings
header, and seeds a few unpublished sectors and categories with taggings in
the dev sample data so the hidden state is exercised locally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread db/seeds/dev/workshops.rb
puts "Creating unpublished sectors with taggings…"
workshop_pool = Workshop.all.to_a
[ "Animal-Assisted Therapy", "School Counseling", "Youth Mentorship" ].each do |sector_name|
sector = Sector.where("LOWER(name) = LOWER(?)", sector_name).first_or_create!(name: sector_name)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Inline case-insensitive first_or_create! rather than the find_or_create_by_name! helper in seeds.rb — this dev file is meant to be runnable standalone (rake db:seed:workshops), where that helper isn't loaded.

Comment thread db/seeds/dev/workshops.rb
# attached to an existing type so they group correctly on the tags page, and stay
# unpublished (they're not on any canonical list).
puts "Creating unpublished categories with taggings…"
art_type = CategoryType.where("LOWER(name) = LOWER(?)", "ArtType").first_or_create!(name: "ArtType", published: true)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: These names are deliberately non-canonical, so base db/seeds.rb never republishes them and they stay hidden. Dev seeds run after base seed, so the unpublished state sticks.


<% border_hover_class = DomainTheme.border_class_for(:sectors, intensity: 500) %>

<% if is_hidden

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: The grey hidden treatment intentionally overrides any explicit bg_color/border passed in (e.g. the bg-white chips on /tags), so hidden always reads as hidden regardless of caller styling.

@maebeale maebeale marked this pull request as ready for review June 17, 2026 17:44
@maebeale maebeale merged commit c599e52 into main Jun 17, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/tags-hidden-icon-chips branch June 17, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant