Hotfix question display

what a mess....
This commit is contained in:
Henne Vogelsang 2016-05-25 14:40:45 +02:00
parent 5765dd1242
commit 3578953b1e
2 changed files with 9 additions and 8 deletions

View file

@ -5,7 +5,7 @@ module Admin
def index
authorize! :index, Question.new(conference_id: @conference.id)
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)
@questions = Question.where(global: true) | @conference.questions
@questions_conference = @conference.questions
@new_question = @conference.questions.new
end

View file

@ -1,7 +1,8 @@
= f.inputs 'Additional Info' do
- @conference.questions.each do |q|
- if q.question_type.id == 1 || q.question_type.id == 2 # yes/no or single choice
= f.input :qanswers, :collection => q.qanswers.joins(:answer).pluck("answers.title, qanswers.id"), :as => :select, :input_html => { :multiple => false },
label: q.title, :include_blank => "Please make your choice"
- if q.question_type.id == 3 # multiple choice
= f.input :qanswers, :collection => q.qanswers.joins(:answer).pluck("answers.title, qanswers.id"), :as => :check_boxes, label: q.title
- if @conference.questions.any?
= f.inputs 'Additional Info' do
- @conference.questions.each do |question|
- if question.question_type.title == 'Yes/No' || question.question_type.title == 'Single Choice'
= f.input :qanswers, :collection => question.qanswers.joins(:answer).pluck("answers.title, qanswers.id"), :as => :select, :input_html => { :multiple => false },
label: question.title, :include_blank => "Please make your choice"
- if question.question_type.title == 'Multiple Choice'
= f.input :qanswers, :collection => question.qanswers.joins(:answer).pluck("answers.title, qanswers.id"), :as => :check_boxes, label: question.title