Files
nairobi/app/components/admin/proposals/toggle_selection_component.rb
Javi Martín fec44c146c Use a switch to toggle proposal selection
The button to select/deselect a proposal wasn't very intuitive; for
example, it wasn't obvious that pressing a button saying "selected"
would deselect the proposal.

So we're using a switch control, like we do to enable/disable features
since commit fabe97e50.
2024-10-25 17:12:44 +02:00

28 lines
450 B
Ruby

class Admin::Proposals::ToggleSelectionComponent < ApplicationComponent
attr_reader :proposal
def initialize(proposal)
@proposal = proposal
end
private
def action
:toggle_selection
end
def selected?
proposal.selected?
end
def options
{
"aria-label": label
}
end
def label
t("admin.actions.label", action: t("admin.actions.select"), name: proposal.title)
end
end