-
Notifications
You must be signed in to change notification settings - Fork 9
Add dedicated Tags management page and hide restricted tags from riders #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add /tags admin page for dispatchers to manage rider tags - Tags can be marked as restricted, hiding them from riders on their profile - Restricted tags are shown with a lock icon in the dispatcher view - Riders can only see and modify non-restricted tags on their profile - Remove inline tag creation from rider edit form (use Tags page instead) - Add Tags link to sidebar navigation
- Add tag fixture in test/support/fixtures.ex for creating test tags - Add context tests in riders_test.exs for tag CRUD operations: - create_tag, update_tag, delete_tag - list_tags, list_tags_with_rider_count - toggle_tag_restricted, change_tag, get_tag!, search_tags - Create tag_live_test.exs for Tags admin page: - List tags with name, restricted status, and rider count - Create, edit, delete tags via modals - Toggle restricted status inline - Access control for non-dispatchers - Add tag visibility tests in rider_live_test.exs: - Dispatcher can see all tags including restricted - Rider cannot see restricted tags on profile - Rider cannot see restricted tags in edit form
teesloane
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few optional nits and comments but can be merged without.
| def render(assigns) do | ||
| ~H""" | ||
| <div class="block w-full px-3 py-2 my-1 border border-gray-300 rounded-md focus-within:outline-none focus-within:ring-1 focus-within:ring-blue-500 focus-within:border-blue-300"> | ||
| <div class="block w-full px-3 py-2 my-1 border border-gray-300 rounded-md"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <div class="block w-full px-3 py-2 my-1 border border-gray-300 rounded-md"> | |
| <div class="flex flex-wrap gap-1 w-full px-3 py-2 my-1 border border-gray-300 rounded-md"> |
This will remove the jumpiness from the tags when toggling them:
CleanShot.2026-01-28.at.09.26.49.mp4
| <span | ||
| class={[ | ||
| "my-0.5 inline-flex items-center px-2.5 py-1.5 rounded-md text-md font-medium cursor-pointer hover:bg-gray-200", | ||
| if(tag.restricted, do: "bg-gray-200 text-gray-500", else: "bg-gray-100 text-gray-500") | ||
| ]} | ||
| phx-click={JS.push("select", value: %{name: tag.name}, target: @myself)} | ||
| > | ||
| <Heroicons.plus mini class="w-4 h-4 mr-1" /> | ||
| {tag.name} | ||
| <Heroicons.lock_closed :if={tag.restricted} mini class="w-4 h-4 ml-1 text-amber-600" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required but we could make this a "dumb component" to tidy up a bit.
| <.header> | ||
| Tags | ||
| <:subtitle> | ||
| Manage rider tags. Restricted tags are hidden from riders on their profile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth saying why one might want to add rider tags / how they are used?
| <% visible_tags = | ||
| if @current_user.is_dispatcher, | ||
| do: @rider.tags, | ||
| else: Enum.reject(@rider.tags, & &1.restricted) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opinion: normally I think it's fine to assign variables in template code, but since we're dealing with content that may be restricted, it might be worth pulling this out into a function and putting it in rider_live/show.ex
Describe your changes
Editing a riders' tags

When not a dispatcher you don't see restricted tags

Checklist before requesting a review
about this update in the description above.