From 7d774959361967871708fd83ae1182f444d849ca Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Wed, 25 May 2016 14:40:45 +0200 Subject: [PATCH] Hotfix question display what a mess.... --- app/controllers/admin/questions_controller.rb | 2 +- .../conference_registrations/_questions.html.haml | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb index 1a805a32..51eefb8a 100644 --- a/app/controllers/admin/questions_controller.rb +++ b/app/controllers/admin/questions_controller.rb @@ -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 diff --git a/app/views/conference_registrations/_questions.html.haml b/app/views/conference_registrations/_questions.html.haml index dcb9b308..935adc8c 100644 --- a/app/views/conference_registrations/_questions.html.haml +++ b/app/views/conference_registrations/_questions.html.haml @@ -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