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.
20 lines
446 B
Ruby
20 lines
446 B
Ruby
class Admin::Poll::Questions::FormComponent < ApplicationComponent
|
|
include TranslatableFormHelper
|
|
include GlobalizeHelper
|
|
attr_reader :question, :url
|
|
delegate :can?, to: :helpers
|
|
|
|
def initialize(question, url:)
|
|
@question = question
|
|
@url = url
|
|
end
|
|
|
|
private
|
|
|
|
def select_options
|
|
Poll.all.select { |poll| can?(:create, Poll::Question.new(poll: poll)) }.map do |poll|
|
|
[poll.name, poll.id]
|
|
end
|
|
end
|
|
end
|