Newer
Older
dmpopidor / app / views / plans / export.docx.erb
<h1><%= @plan.title %></h1>
<h2><%= @plan.template.title %></h2>

<% details = @exported_plan.admin_details %>
<% if details.present? && @show_details %>
  <h3><%= _('Admin Details') %></h3>
  <% details.each do |field| %>
    <% value = @exported_plan.send(field) %>
    <p>
      <strong><%= admin_field_t(field.to_s) %>:</strong>
      <%= value.present? ? value : _('-') %>
    </p>
  <% end %>
<% end %>



<% @sections.each do |section| %>
  <h3><%= section.title %></h3>
  <% section.questions.each do |question| %>
    <% answer = @plan.answer(question.id, false) %>
    <% if answer.nil? && !@unanswered_questions then next end %>
    <% if @question_headings %>
      <%= raw question.text %>
    <% end %>
    <% 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><%= raw option.text %></li>
        <% end %>
        </ul>
        <% if question.option_comment_display %>
          <%= raw answer.text %>
        <% end %>
      <% else %>
        <%= raw answer.text %>
      <% end %> <!-- end if q_format.option_based? -->
    <% end%> <!-- end if answer.nil? --> 
    <p></p>
  <% end %>	<!-- end questions.each -->
<% end %> <!-- end @exported_plan.sections.each -->