app/views/fe/answer_sheets/_element.html.erb in fe-0.0.4 vs app/views/fe/answer_sheets/_element.html.erb in fe-1.0.0
- old
+ new
@@ -1,41 +1,56 @@
-<% if element.kind == "Fe::QuestionGrid" -%>
+<% if element.kind == "Fe::QuestionGrid" || element.kind == "Fe::QuestionGridWithTotal"-%>
<li>
- <label class="desc"><%= raw element.label %></label>
- <table class="grid">
- <%- if element.cols -%>
- <tr>
- <%- element.cols.split(';').each do |header| -%>
- <th><%= raw header || ' ' %></th>
- <%- end -%>
- </tr>
- <%- end -%>
- <tr>
- <%- col_count = 0
- element.elements.each do |grid_element| -%>
- <td id="element_<%= element.id %>">
- <% if %w(Fe::Paragraph).include?(grid_element.kind) -%>
- <%= simple_format grid_element.content %>
- <% else -%>
- <%# el = elements.detect {|el| el.id == grid_element.id } -%>
- <% if grid_element.question? -%>
- <label class="desc"><%= raw grid_element.label %></label>
- <% end %>
- <span class="answer"><%= simple_format grid_element.display_response(@answer_sheet) %></span>
- <% end -%>
- </td>
- <%- col_count += 1
- if col_count % element.num_cols == 0 then col_count = 0 -%></tr><tr><%- end -%>
- <%- end -%>
- <%- while col_count < element.num_cols do
- col_count += 1-%>
- <td> </td>
- <%- end unless col_count == 0-%>
- </tr>
- </table>
+ <label class="desc"><%= raw element.label %></label>
+ <table class="grid">
+ <%- if element.cols -%>
+ <tr>
+ <%- element.cols.split(';').each do |header| -%>
+ <th><%= raw header || ' ' %></th>
+ <%- end -%>
+ </tr>
+ <%- end -%>
+ <tr>
+ <%- col_count = 0
+ element.elements.each do |grid_element| -%>
+ <td id="element_<%= element.id %>">
+ <% if %w(Fe::Paragraph).include?(grid_element.kind) -%>
+ <%= simple_format grid_element.content %>
+ <% else -%>
+ <%# el = elements.detect {|el| el.id == grid_element.id } -%>
+ <% if grid_element.question? -%>
+ <label class="desc"><%= raw grid_element.label %></label>
+ <%- if @collating -%>
+ <%- for answer_sheet in @collated_answer_sheets[@answer_sheet] -%>
+ <div class="answer collate">
+ <span class="reviewer_name"><%= answer_sheet.collat_title %>:</span>
+ <span class="reviewer_answer"><%= simple_format grid_element.display_response(answer_sheet) %></span>
+ </div>
+ <%- end -%>
+ <%- else -%>
+ <span class="answer"><%= simple_format grid_element.display_response(@answer_sheet) %></span>
+ <%- end -%>
+ <% elsif grid_element.is_a?(Fe::QuestionGrid) || grid_element.is_a?(Fe::QuestionGridWithTotal) %>
+ <ul>
+ <%= render :partial => 'fe/answer_sheets/element', :object => grid_element %>
+ </ul>
+ <% else %>
+ <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element %>
+ <% end %>
+ <% end -%>
+ </td>
+ <%- col_count += 1
+ if col_count % element.num_cols == 0 then col_count = 0 -%></tr><tr><%- end -%>
+ <%- end -%>
+ <%- while col_count < element.num_cols do
+ col_count += 1-%>
+ <td> </td>
+ <%- end unless col_count == 0-%>
+ </tr>
+ </table>
</li>
-<% elsif element.question_grid_id.nil? && element.conditional_id.nil? -%>
+<% else %>
<li>
<% if element.question? -%>
<label class="desc"><%= raw element.label %></label>
<%- if @collating -%>
<%- for answer_sheet in @collated_answer_sheets[@answer_sheet] -%>
@@ -49,6 +64,9 @@
<%- end -%>
<% else -%>
<%= render :partial => 'fe/questions/' + element.ptemplate, :object => element %>
<% end -%>
</li>
+ <% element.choice_field_children.each do |choice_field_child| %>
+ <%= render 'fe/answer_sheets/element', element: choice_field_child %>
+ <% end %>
<% end -%>