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 t("helpers.preview"), admin_previewphase_template_path(phase), class: 'btn btn-primary'%>
      <% end %>
      <% if !phase.template.published? %>
          <%= link_to t("helpers.submit.delete"), admin_destroyphase_template_path(phase_id: phase.id),
          confirm: t("org_admin.templates.phase_delete_message", phase_title: phase.title ), method: :delete, class: "btn btn-primary"%>
      <% end %>
      <% if !phase.modifiable %>
          <% b_label = t('org_admin.templates.view_phase_label')%>
      <% else %>
          <% b_label = t('org_admin.templates.edit_phase_label')%>
      <% end %>
      <%= link_to b_label, admin_phase_template_path(id: phase.id, edit: (b_label == t('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"><%= t('helpers.sections_label')%></th>
              <th class="dmp_th_big"><%= t('helpers.questions_label')%></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>