skill-assessment-app/app/views/admin/question/_form.html.erb

50 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2016-08-19 16:42:06 -05:00
<%= render partial: 'shared/form_model_errors', locals: { obj: question} %>
2017-03-20 10:57:50 -05:00
2016-08-19 16:02:18 -05:00
<%= form_for question, url: action do |form| %>
2017-03-20 10:57:50 -05:00
<div>
2016-08-19 16:02:18 -05:00
<%= form.label :quiz_id, 'Quiz' %>
<%= form.select :quiz_id, options_for_select(@quizzes.map{ |q| [q.name, q.id] }, question.quiz_id), include_blank: (@quizzes.size > 1) %>
</div>
2017-03-20 10:57:50 -05:00
<div>
2016-08-19 16:02:18 -05:00
<%= form.label :category, 'Category' %>
<%= form.text_field :category %>
</div>
2017-03-20 10:57:50 -05:00
<div>
2016-08-19 16:02:18 -05:00
<%= form.label :sort, 'Sort' %>
<%= form.text_field :sort %>
</div>
2017-03-20 10:57:50 -05:00
<div>
2016-08-19 16:02:18 -05:00
<%= form.check_box :active %>
<%= form.label :active, 'Active' %>
</div>
2017-03-20 10:57:50 -05:00
<div>
2016-08-19 16:02:18 -05:00
<%= form.label :question, "Question" %>
<%= form.text_area :question %>
</div>
2017-03-20 10:57:50 -05:00
<div>
<%= form.label :attachment, "Attachment URL" %>
<%= form.text_field :attachment %>
2017-03-20 10:57:50 -05:00
<%= image_tag @question.attachment if @question.attachment.present? %>
</div>
2017-03-20 10:57:50 -05:00
<div>
2016-08-19 16:02:18 -05:00
<%= form.label :input_type, 'Input Type' %>
<%= form.select :input_type, question_type_options(question.input_type), { include_blank: false }, { data: { qid: question.id } } %>
2016-08-19 16:02:18 -05:00
</div>
2017-03-20 10:57:50 -05:00
<div>
<%= fields_for @question do |fields| %>
<% partial = question.input_type.blank? ? 'admin/question/text' : "admin/question/#{question.input_type}" %>
<%= render partial: partial, locals: {question: question, fields: fields } %>
<% end %>
</div>
2016-08-19 16:02:18 -05:00
<%= form.submit %>
<% end %>