osem-fcy/app/views/admin/surveys/_survey_question.html.haml
2016-06-30 14:52:43 +02:00

49 lines
2.1 KiB
Text

.panel.panel-default
.panel-heading
%span.badge
= index
= survey_question.title
- if survey_question.multiple_choice?
( Select
- if survey_question.min_choices != survey_question.max_choices
a minimum of
= survey_question.min_choices
- if survey_question.min_choices != survey_question.max_choices
and a maximum of
= survey_question.max_choices
choices )
- if survey_question.mandatory
%span.fa.fa-asterisk.text-danger
- if can? :edit, @survey
%p.pull-right
= link_to edit_admin_conference_survey_survey_question_path(@conference.short_title, @survey, survey_question) do
%span.fa.fa-edit
= link_to admin_conference_survey_survey_question_path(@conference.short_title, @survey, survey_question), method: :delete, data: { confirm: 'Are you sure you want to delete this question?' } do
%span.fa.fa-times
.panel-body
- if survey_question.boolean?
= f.input "survey_question_#{survey_question.id}", as: :radio, name: 'Yes'
%br
= f.input "survey_question_#{survey_question.id}", as: :radio, name: 'No'
- elsif survey_question.choice?
- survey_question.possible_answers.split(',').map(&:strip).each do |option|
- if survey_question.single_choice?
%input{ type: 'radio', name: "survey_question_#{survey_question.id}" }
= option
%br
- else
%input{ type: 'checkbox', name: "survey_question_#{survey_question.id}" }
= option
%br
- elsif survey_question.string?
%input.form-control{ name: "survey_question_#{survey_question.id}" }
- elsif survey_question.text?
%textarea.form-control{ rows: 4, name: "survey_question_#{survey_question.id}" }
- elsif survey_question.datetime?
.form-group{ class: 'datetimepicker' }
.input-group
.input-group-addon
%span.fa.fa-calendar
%input.form-control{ readonly: 'readonly', name: "survey_question_#{survey_question.id}" }
- elsif survey_question.numeric?
%input.form-control{ type: 'number', name: "survey_question_#{survey_question.id}" }