Newer
Older
dmpopidor / app / views / org_admin / templates / _show_phases_sections.html.erb
<!-- Display of phase, sections and its questions. A phase is passed as an argument -->
<div class="row">
  <div class="col-md-12">
    <p class="text-justify">
      <%= raw phase.description %>
    </p>
  </div>
</div>
<div class="row">
  <div class="col-md-12">
    <div class="pull-right">
      <% phase_button_text = template.customization_of.nil? ? _('Show Phase') : _('Customize Phase') %>
      <%= link_to phase_button_text, admin_show_phase_path(id: phase.id), { class: "btn btn-default", role: 'button' } %>
      <% if template == current && phase.modifiable %>
        <%= link_to _('Delete phase'), admin_destroy_phase_path(phase_id: phase.id),
                    data: { confirm: _("You are about to delete the '%{phase_title}' phase. This will remove all of the sections and questions listed below. Are you sure?") % { phase_title: phase.title }, 
                            length: 20, omission: _('... (continued)') }, method: :delete, class: 'btn btn-default', role: 'button' %>
      <% end %>
    </div>
  </div>
</div>
<div class="row">
  <div class="col-md-12">
    <% if phase_hash[:sections].length > 0 %>
      <div class="table-responsive">
          <table class="table table-hover">
            <thead>
              <tr>
                <th><%= _('Sections')%></th>
                <th><%= _('Questions')%></th>
              </tr>
            </thead>
            <tbody>
              <% (phase_hash[:sections].values.sort_by { |key| key[:data][:number] }).each do |section| %>
                <tr>
                  <td>
                    <p><%= section[:data].title %></p>
                  </td>
                  <td>
                    <% if section[:questions].present? %>
                      <ul>
                        <% (section[:questions].values.sort_by { |key| key[:data][:number] }).each do |question| %>
                          <li><%= raw question[:data].text %></li>
                        <% end %>
                      </ul>
                    <% end %>
                  </td>
                </tr>
              <% end %>
            </tbody>
          </table>
      </div>
    <% end %>
  </div>
</div>