Files
nairobi/app/components/admin/poll/questions/table_actions_component.rb
Julian Herrero 8a26954bc5 Don't allow to modify questions for started polls
Adding, modifiying, and/or deleting questions for an already started
poll is far away from being democratic and can lead to unwanted side
effects like missing votes in the results or stats.

So, from now on, only modifiying questions will be possible only if
the poll has not started yet.
2022-09-20 17:50:35 +02:00

15 lines
296 B
Ruby

class Admin::Poll::Questions::TableActionsComponent < ApplicationComponent
attr_reader :question
delegate :can?, to: :helpers
def initialize(question)
@question = question
end
private
def actions
[:edit, :destroy].select { |action| can?(action, question) }
end
end