Newer
Older
dmpopidor / app / views / templates / admin_template.html.erb
@briley briley on 22 Jun 2017 3 KB css rewrite
<% javascript 'admin.js' %>

<h1>
  <%= @template.title %>
</h1>

<div class="right">
  <a href="<%= admin_index_template_path %>" class="link-as-button"><%= _('View all templates') %></a>
</div>
<br />
	
<div class="content">
	
	<!-- templates navigation -->
	<div class="tabbed-area">
	  <ul class="tabs" role="tablist">
	    <li id="details-tab" class="active" role="tab">
	      <a href="#details-panel" aria-selected="true"><%= _('Template details') %></a>
	    </li>
    
			<!-- Generate a tab for each phase -->
			<% @template.phases.each do |phase| %>
		    <li id="phase-<%= phase.id %>-tab" role="tab">
		      <a href="phase-<%= phase.id %>-panel" aria-selected="false">
						<%= phase.title %>
					</a>
		    </li>
			<% end %>
		
			<!-- Generate the new phase tab -->
	    <% if current_user.can_org_admin? &&
	            (@template.org.funder? || current_user.org.funder? || (@template.org == current_user.org)) %>
			  <% if (@template == @current || @edit) && @template.customization_of.nil? %>
				  <li id="add-phase-tab" role="tab">
						<a href="<%= admin_add_phase_path(template) %>" aria-selected="false"><%= _('Add new phase') %></a>
				  </li>
				<% end %>
			<% end %>
	  </ul>

    <div class="tab-panels" role="tabpanel">
			
      <!-- Generate the template details panel -->
			<div id="details-panel" class="tab-panel active" aria-hidden="false" 
           aria-labelledby="details-tab">
  
			  <% if @template == @current && @template.customization_of.nil? %>
	      	<%= render partial: "templates/edit_template", locals: {template: @template, hash: @hash} %>
				<% else %>
					<%= render partial: "templates/show_template", locals: {template: @template, current: @current, hash: @hash} %>
				<% end %>	
      </div>

			<!-- Generate each phase panel -->
			<% @template.phases.each do |phase| %>
				<div id="phase-<%= phase.id %>-panel" class="tab-panel" aria-hidden="true" 
						aria-labelledby="phase-<%= phase.id %>-tab">
					
	        <div id="template-accordion">
						<% phase.sections.each do |section| %>
							<%= render partial: 'sections/show', locals: {section: section} %>
						<% end %>
					</div>
				</div>
			<% end %>
			
		</div>
	</div>
</div>
	          <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>
					
				</div>
			<% end %>



  <!-- 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] %>
        
      <% end %>
    <% end %>
  <% end %>

</div>

<%= tinymce %>