Newer
Older
dmpopidor / app / views / templates / admin_template.html.erb
@briley briley on 14 Jun 2017 2 KB rebranding
<% javascript 'admin.js' %>

<h1>
  <%= @template.title %>
  <!-- link button to add new guidance -->
  <div class="move_2_right">
    <%= link_to _('View all templates'),
                admin_index_template_path,
                class: 'btn btn-primary' %>
  </div>
</h1>

<div class="div_clear"></div>

<!-- render navigation tabs for the template-->
<%= render partial: "templates/admin_nav_tabs", locals: {template: @template, hash: @hash, active: "show_template"} %>

<!-- body -->
<div class="dmp_details_body">
  <div class="dmp_details">
    <% if @template == @current && @template.customization_of.nil? %>
      <div id="edit_template_div" style="display: none">
        <%= render partial: "templates/edit_template", locals: {template: @template, hash: @hash}%>
      </div>
    <% end %>
    <div id="show_template_div">
      <%= render partial: "templates/show_template", locals: {template: @template, current: @current, hash: @hash}%>
    </div>
  </div>
  <!-- If template has phases-->
  <% if @hash[:template][:phases].present? %>
    <% if @hash[:template][:phases].length == 1 %>
      <% @hash[:template][:phases].each do |phase_no, phase| %>
        <!--render the display block with the phase, sections and questions information-->
        <%= render partial: 'templates/show_phases_sections', locals: {phase: phase[:data], phase_hash: phase, template: @template, current: @current} %>
      <% end %>
    <% else %>
      <% (1..@hash[:template][:phases].length).each do |phase_no| %>
        <% phase = @hash[:template][:phases][phase_no] %>
        <div class="accordion" id="project-accordion">
          <div class="accordion-group">
            <div class="accordion-heading">
              <a class="accordion-toggle" data-toggle="collapse" data-parent="#project-accordion" href="#<%= phase[:data][:id] %>">
                <h3><%= phase[:data].title %><span class="plus-laranja"> </span>
                </h3>
              </a>
            </div>
            <div id="<%= phase[:data][:id] %>" class="accordion-project collapse">
              <div class="accordion-inner">
                <!--render the display block with the phase, sections and questions information-->
                <%= render partial: 'templates/show_phases_sections', locals: {phase: phase[:data], phase_hash: phase, template: @template, current: @current}%>
              </div>
            </div>
          </div>
        </div>
      <% end %>
    <% end %>
  <% end %>
</div>

<%= tinymce %>