<%# locals: { template, question, answer, readonly, locking } %> <!-- This partial creates a form for each type of question. The local variables are: plan, answer, question, readonly --> <!-- Question text --> <% q_format = question.question_format %> <% if q_format.rda_metadata? %> <p> <strong><%= raw question.text %></strong> </p> <% answer_hash = answer.answer_hash %> <div class="rda_metadata"><button class="remove-standard" style="display:none;"></button> <div class="selected_standards"><strong><%=_("Your Selected Standards:")%></strong></br><ul class="list bullet"></ul></div> <div class="rda_right" style="float:right;width:50%;margin-bottom:5px;display:none;"> OR Search:</br> <input type="text" data-provide="typeahead" class="standards-typeahead"></input></br> <button class="btn btn-primary select_standard_typeahead"><%=_("Add Standard")%></button> </div> <div class="subject"><%=_("Please select a subject")%></br> <select name="subject" class="form-control"></select> </div> <div class="sub-subject"><%=_("Please select a sub-subject")%></br> <select name="sub-subject" class="form-control"></select> </div> </br> <div class="suggested-answer-div"> <span class="suggested-answer-intro"> <strong><%=_("Browse Standards") %></strong> </span> <div class="browse-standards-border"> <p class="suggested-answer"> <strong><%=_("Please wait, Standards are loading")%></strong> </p> </div> <div> <a href="#" class="custom-standard"><strong>Standard not listed? Add your own.</strong></a> <div class="add-custom-standard" style="display:none;"> <input type="text" class="custom-standard-name"></input> <button class="btn btn-primary submit_custom_standard">Add Standard</button> </div> </div> </div> </div> <% end %> <%= form_for answer, url: create_or_update_answers_path(question_id: question.id), html: {method: :post, 'data-autosave': question.id, class: 'form-answer' } do |f| %> <% if !readonly %> <%= f.hidden_field :plan_id %> <%= f.hidden_field :question_id %> <%= f.hidden_field :lock_version %> <% if q_format.rda_metadata? %> <%= hidden_field_tag :standards, answer_hash['standards'].to_json %> <% end %> <% end %> <fieldset <%= 'disabled' if readonly %>> <% if question.option_based? || question.question_format.rda_metadata? %> <%= render(partial: 'questions/new_edit_question_option_based', locals: { f: f, question: question, answer: answer }) %> <% elsif question.question_format.textfield?%> <%= render(partial: 'questions/new_edit_question_textfield', locals: { f: f, question: question, answer: answer }) %> <% elsif question.question_format.textarea? %> <%= render(partial: 'questions/new_edit_question_textarea', locals: { f: f, question: question, answer: answer, locking: locking }) %> <% end %> <%= f.button(_('Save'), class: "btn btn-default", type: "submit") %> </fieldset> <!--Example Answer area --> <% if template.present? && template.org.present? %> <% question.get_example_answers([base_template_org.id, template.org.id]).each do |annotation| %> <% if annotation.present? && annotation.org.present? && annotation.text.present? %> <div class="panel panel-default"> <span class="label label-default"> <%="#{annotation.org.abbreviation} "%> <%=_('example answer')%> </span> <div class="panel-body"> <%= raw annotation.text %> </div> </div> <% end %> <% end %> <% end %> <% end %>