Newer
Older
dmpopidor / app / views / templates / _show_phases_sections.html.erb
<!-- 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.sections.length > 0 %>
          <%= link_to _('Preview'), admin_preview_phase_path(id: phase.id), class: 'btn btn-primary'%>
      <% end %>
      <% if !phase.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.sections.any? %>
    <table class="dmp_table">
      <thead>
          <tr>
              <th class="dmp_th_medium"><%= _('Sections')%></th>
              <th class="dmp_th_big"><%= _('Questions')%></th>
        </tr>
      </thead>
      <tbody>
        <% phase.sections.order("number ASC").each do |section| %>
          <tr >
            <th class="dmp_th_border" >
              <p><%= section.title %></p>
            </th>
            <td class="dmp_td_border" >
              <% if section.questions.any? %>
                <% questions = section.questions.order("number ASC") %>
                <ul class="question_ul">
                  <% questions.each do |ques|%>
                    <li>
                      - <%= raw ques.text %>
                    </li>
                  <% end %>
                </ul>
              <% end %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  <% end %>


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