<!-- Display of phases, sections and it's questions. A phase is passed as an argument-->
<div class="div_clear"></div>
<div class="div_left admin_left_smaller">
<p><%= raw phase.description %></p>
</div>
<div class="div_right admin_right_bigger">
<!--delete a phase button. only displays when template not published-->
<% if phase_hash[:sections].length > 0 %>
<%= link_to _('Preview'), admin_preview_phase_path(id: phase.id), class: 'btn btn-primary'%>
<% end %>
<% if !template.published? %>
<%= link_to _('Delete'), admin_destroy_phase_path(phase_id: phase.id),
confirm: _("You are about to delete '%{phase_title}'. This will affect versions, sections and questions linked to this phase. Are you sure?") % { :phase_title => phase.title }, method: :delete, class: "btn btn-primary"%>
<% end %>
<% if !phase.modifiable %>
<% b_label = _('View phase')%>
<% else %>
<% b_label = _('Edit phase')%>
<% end %>
<%= link_to b_label, admin_show_phase_path(id: phase.id, edit: (b_label == _('org_admin.templates.edit_phase_label'))), class: "btn btn-primary" %>
</div>
<% if phase_hash[:sections].present? %>
<table class="dmp_table">
<thead>
<tr>
<th class="dmp_th_medium"><%= _('Sections')%></th>
<th class="dmp_th_big"><%= _('Questions')%></th>
</tr>
</thead>
<tbody>
<% (1..phase_hash[:sections].length).each do |section_no| %>
<% section = phase_hash[:sections][section_no] %>
<tr >
<th class="dmp_th_border" >
<p><%= section[:data].title %></p>
</th>
<td class="dmp_td_border" >
<% if section[:questions].present? %>
<ul class="question_ul">
<% (1..section[:questions].length).each do |question_no|%>
<li>
- <%= raw section[:questions][question_no][:data].text %>
</li>
<% end %>
</ul>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<div class="div_clear"></div>