Newer
Older
dmpopidor / app / views / plans / export.html.erb
<div id="export_font">
  <h1><%= @plan.title %></h1>
  <h2><%= @plan.template.title %></h2>
  <div class="dmp_details_body">
    <div class="dmp_details">
      <% details = @exported_plan.admin_details %>
      <% if details.present?  && @show_details %>
        <h3><%= _('Admin Details') %></h3>
        <table class="dmp_table">
          <thead>
            <tr>
              <th class="dmp_th_medium"><%= _('Title')%></th>
              <th class="dmp_th_big"><%= _('Description')%></th>
            </tr>
          </thead>
          <tbody>
          <%
            details.each do |field|
              value = @exported_plan.send(field)
          %>
            <tr>
              <th class="dmp_th_border"><p>- <%= admin_field_t(field.to_s) -%></p></th>
              <td class="dmp_td_border"><%= value.present? ? value : _('-') %></td>
            </tr>
            <% end %>
          </tbody>
        </table>
     <% end %>
      <% @sections.each do |section| %>
        <% if @question_headings %>
          <h3><%= section.title %></h3>
        <% end %>
        <table class="dmp_table">
          <thead>
            <tr>
              <% if @question_headings %>
              <th class="dmp_th_medium"><%= _('Questions')%></th>
              <th class="dmp_th_big"><%= _('Answers')%></th>
              <% else %>
              <th class="dmp_th_big"></th>
              <% end %>
            </tr>
          </thead>
          <tbody>
            <% section.questions.order(:number).each do |question| %>
            <tr>
              <% answer = @plan.answer(question.id, false) %>
              <% if !@unanswered_questions && answer.blank?
                  next # skip unanswered questions
                end %>
              <% if @question_headings %>
              <th class="dmp_th_border" >
                <p>- <%= raw question.text %></p>
              </th>
              <% end %>
              <td class="dmp_td_border" >
                <% if answer.nil? %>
                  <p><%= _('Question not answered') %></p>
                <% else %>
                  <% q_format = question.question_format %>
                  <% if q_format.option_based? %>
                    <ul>
                      <% answer.question_options.each do |option| %>
                        <li><%= option.text %></li>
                      <% end %>
                    </ul>
                    <% if question.option_comment_display == true %>
                      <%= raw answer.text %>
                    <% end %>
                  <% else%>
                    <%= raw answer.text %>
                  <% end%>
                <% end %>
              </td>
            </tr>
            <% end %>
          </tbody>
        </table>
      <% end %> <!-- end @exported_plan.sections.each -->
    </div>
  </div>
</div>