Favorite Actions System - FreeUKGen/MyopicVicar GitHub Wiki
Favorite Actions
Part of Transcriber & Coordinator Workflow.
Controller: app/controllers/favorite_actions_controller.rb (no dedicated model)
A small per-user UI convenience: a logged-in user can pin up to 5 frequently-used menu actions (drawn from whatever their person_role exposes via UseridRole::OPTIONS) for quick access, rather than navigating the full role menu each time.
Storage
There's no FavoriteAction model — favorite_actions is just an Array field (default []) directly on UseridDetail-System, with the logic living there: add_favorite_action, remove_favorite_action, favorite_actions_sorted, can_add_favorite? (enforces the 5-item cap).
Controller actions
add/remove— single-item add/remove, redirect-back with a flash message.manage— shows available-vs-currently-selected actions for the user's role.update_favorites— bulk-replaces the whole list; validates the new list is ≤5 items and that every selected action actually appears inUseridRole::OPTIONS.fetch(@user.person_role)before saving, rejecting with a flash otherwise.
Routes
Custom only, no resources :favorite_actions: favorite_actions/manage (GET), favorite_actions/update (POST), favorite_actions/add (POST), favorite_actions/remove (DELETE).