Newer
Older
dmpopidor / app / views / templates / admin_template.html.erb
<div class="row">
  <div class="col-md-12">
    <h1><%= @template.title %></h1>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
  
    <div class="tabbed-area">
      <!-- render navigation tabs for the template-->
      <%= render partial: "templates/admin_nav_tabs", locals: {template: @template, hash: @hash, active: "show_template"} %>

      <div class="tab-panels dmp_details_body" role="tabpanel">
        <!-- phase main container -->
        <div id="details-panel" class="tab-panel active dmp_details_body"
             aria-hidden="false" aria-labelledby="details-tab">

          <div class="accordion">
            <h2><%= _('Template details')%><span class="fa fa-minus" aria-hidden="true"> </span></h2>
          
            <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] %>
                  <h2><%= phase[:data].title %><span class="fa fa-plus" aria-hidden="true"></span></h2>
      
                  <div id="<%= phase[:data][:id] %>">
                    <!--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>
                <% end %>
              <% end %>
            <% end %>
          </div><!-- close accordion -->
        
        </div><!-- close panel -->
      </div><!-- close panels -->
    </div><!-- tabbed area -->

  </div>
</div>