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.
28 lines
450 B
Ruby
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
|