Newer
Older
dmpopidor / app / views / annotations / _edit.html.erb
<!--edit annotation. question is passed as an argument-->
<h3><%= _('Edit Annotations') %></h3>
<%= form_tag admin_update_annotation_path, method: :put do %>
  <% example_answer_text  = example_answer.present? ? example_answer.text : '' %>
  <% guidance_text        = guidance.present?       ? guidance.text       : '' %>
  <%= hidden_field_tag :example_answer_id, example_answer.present? ? example_answer.id : nil %>
  <%= hidden_field_tag :guidance_id, guidance.present? ? guidance.id : nil %>
<div class="form-group">
  <%= label_tag _('Example Answer') , nil , class: 'col-md-2 control-label' %>
  <div class="col-md-10" >
    <%= text_area_tag :example_answer_text, example_answer_text, rows: 5 %>
  </div>
</div>
<div class="form-group">
  <%= label_tag _('Guidance') , nil , class: 'col-md-2 control-label' %>
  <div class="col-md-10">
    <%= text_area_tag :guidance_text, guidance_text,  rows: 5 %>
  </div>
</div>

  <br/>

  <!-- submit/ delete buttons -->
  <div class="pull_right">
    <%= submit_tag _('Save'), class: 'btn btn-primary' %>
    <% if example_answer.present? %>
      <%= link_to _('Delete Example Answer'), admin_destroy_annotation_path(id: example_answer.id),
        confirm: _("You are about to delete an example answer for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%>
    <% end %>
    <% if guidance.present? %>
      <%= link_to _('Delete Example Answer'), admin_destroy_annotation_path(id: guidance.id),
        confirm: _("You are about to delete a guidance for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%>
    <% end %>

    <%= hidden_field_tag :question_id, question.id, class: "question_id" %>
    <%= link_to _('Cancel'), "#edit_annotations_div_#{question.id}", class: 'btn cancel btn-default cancel_edit_annotations', role: 'button' %>
  </div>
<% end %>