added attachement to admin/question form and view

This commit is contained in:
Mark Moser 2016-08-24 16:55:55 -05:00
parent 2f61d58bba
commit 24c61482fe
2 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,15 @@
<%= form.text_area :question %>
</div>
<div class="form-group">
<%= form.label :attachment, "Attachment URL" %>
<%= form.text_field :attachment %>
<% if @question.attachment.present? %>
<p><%= image_tag @question.attachment %></p>
<% end %>
</div>
<div class="form-group">
<%= form.label :input_type, 'Input Type' %>
<%= form.select :input_type, question_type_options(question.input_type), { include_blank: false }, { data: { qid: question.id } } %>

View File

@ -27,6 +27,10 @@
<strong>Question</strong>
<p><%= @question.question %></p>
<% if @question.attachment.present? %>
<p><%= image_tag @question.attachment %></p>
<% end %>
<%= fields_for @question do |fields| %>
<%= render partial: "admin/question/#{@question.input_type}", locals: {question: @question, disable: true, fields: fields } %>
<% end %>