<div class="row">
<div class="col-md-12">
<h3><%= _('Section details') %></h3>
</div>
</div>
<div class="row">
<div class="col-md-12">
<%= form_for(section, url: admin_update_section_path(section, phase: phase), html: { method: :put }) do |f| %>
<div class="form-group col-md-10">
<%= f.label(:title, _('Title') ,class: "control-label") %>
<%= f.text_field(:title, { class: "form-control", 'aria-required': false, placeholder: _('Enter a title for the section'), 'data-toggle': 'tooltip', title: _('Enter a title for the section')} ) %>
</div>
<div class="form-group">
<div class="col-md-10">
<%= f.label(:number, _('Order of display'), class: "control-label") %>
</div>
<div class="col-md-4">
<%= f.number_field(:number, in: 1..15, class: "form-control", 'aria-required': false, 'data-toggle': 'tooltip', title: _('This allows you to order sections.')) %>
</div>
</div>
<div class="form-group col-md-10">
<%= f.label(:description, _('Description'), class: "control-label") %>
<div data-toggle="tooltip" title="<%= _("Enter a basic description. This could be a summary of what is covered in the section or instructions on how to answer. This text will be displayed in the coloured banner once a section is opened to edit.") %>">
<%= text_area_tag('section-desc', section.description, class: "section tinymce form-control") %>
</div>
</div>
<div class="form-group col-md-4 pull-right">
<%= f.button(_('Save'), class: 'btn btn-default', type: "submit") %>
<%= link_to _('Cancel'), admin_show_phase_path(section.phase), class: 'btn btn-default', role: 'button' %>
<%= link_to _('Delete'), admin_destroy_section_path(section_id: section.id),
confirm: _("You are about to delete '%{section_title}'. This will affect questions linked to this section. Are you sure?") % { :section_title => section.title }, method: :delete, class: 'btn btn-default', role:'button' %>
</div>
<% end %>
</div>
<div class="col-md-12">
<h3><%= _('Questions') %></h3>
<% questions = section.questions.order('number') %>
<% if questions.present? %>
<% questions.each do |question| %>
<hr />
<div class="question_show" id="<%= "question_show#{question.id}" %>">
<%= render partial: 'questions/show_question', locals: {question: question} %>
</div>
<div class="question_edit" id="<%= "question_edit#{question.id}" %>" style="display: none;">
<%= render partial: 'questions/edit_question', locals: {question: question} %>
</div>
<%= raw("<hr />") if questions.last.id == question.id %>
<% end %>
<% end %>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="pull-right">
<%= link_to(_('Add Question'), '#', { class: 'btn btn-default question_new_link', role: "button" }) %>
</div>
<div class="question_new" style="display: none;">
<%= render partial: 'questions/add_question', locals: { section: section } %>
</div>
</div>
</div>