app/views/admin/questions/_form.html.haml
.row
.col-md-6
%legend Question
.form-group
= f.label :title, 'Your Question'
= f.text_field :title, class: 'form-control'
.form-group
= f.select :question_type_id, QuestionType.all.pluck(:title, :id), {}, { class: 'form-control' }
.checkbox
%label
= f.check_box :global
Make Global
%span.help-block
Global questions are available for selection to all conferences
.col-md-6.hidden{id: 'answers_col'}
= dynamic_association :answers, 'Answers', f,
hint: 'Insert your answers in the order you want them to appear'
:javascript
$("#question_question_type_id").change(function () {
var selected_type = $(this).find('option:selected').text();
if (selected_type == 'Yes/No')
$('#answers_col').addClass('hidden');
else
$('#answers_col').removeClass('hidden');
end
});