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.
15 lines
296 B
Ruby
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
|