%- if ["question_pages", "question_sheets", "elements"].include?(controller.controller_name) -%>
<% if question_grid.label.present? && !question_grid.hide_label? -%>
<% end %>
<%- if question_grid.elements.length > 0 -%>
<%= render partial: "fe/admin/question_pages/element", collection: question_grid.elements, locals: {in_grid: true} %>
<%- else -%>
Grid
<%- end -%>
<%- else -%>
<% if question_grid.label.present? && !question_grid.hide_label? -%>
<% end %>
<% headers = question_grid.cols.to_s.split(";") %>
<% if headers.length > 1 %>
<% if headers.detect {|h| h.strip.present?} %>
<%- headers.each do |header| -%>
<%= raw header || " " %> |
<%- end -%>
<% end %>
<% if question_grid.style == "radio" %>
<% question_grid.elements.each do |element| -%>
<%= render partial: "fe/answer_pages/element", object: element %>
<% end %>
<% else %>
<%- col_count = 0; previous_element = nil;
question_grid.elements.each do |element| -%>
" class="hidecell <%= element.class.to_s.downcase.gsub("::","_") %> <%= element.style.to_s.downcase %> <%= "conditional" if element.conditional %>" id="element_<%= element.id %>" <% if element.conditional %>data-conditional_id="<%= element.conditional_id %>" data-conditional_type="<%= element.conditional_type %>" data-conditional_answer="<%= element.conditional_answer %>" data-application_id="<%= @answer_sheet.id %>" data-answer_sheet_id_prefix="<%= @answer_sheet.class.name.underscore.gsub("/","_") %>"<% end %>>
<%# grid_el = @elements.to_a.find {|el| el.id == element.id} %>
<%= render partial: "fe/answer_pages/element", object: element, locals: {col: col_count} %>
|
<%- previous_element = element;
col_count += 1
if col_count % question_grid.num_cols == 0 && element != question_grid.elements.last then col_count = 0 -%>
<%- end -%>
<%- end -%>
<%- while col_count < question_grid.num_cols do
col_count += 1-%>
|
<%- end unless col_count == 0-%>
<% end %>
<% else %>
<% if headers[0].to_s.strip.present? %>
<% end %>
<% previous_element = nil %>
<% question_grid.elements.each do |element| -%>
" class="<%= "row" unless Fe.bootstrap %> <%= element.class.to_s.downcase.gsub("::","_") %> <%= element.style.to_s.downcase %> <%= "conditional" if element.conditional %>" id="element_<%= element.id %>" <% if element.conditional %>data-conditional_id="<%= element.conditional_id %>" data-conditional_type="<%= element.conditional_type %>" data-conditional_answer="<%= element.conditional_answer %>" data-application_id="<%= @answer_sheet.id %>" data-answer_sheet_id_prefix="<%= @answer_sheet.class.name.underscore.gsub("/","_") %>"<% end %>>
<%= render partial: "fe/answer_pages/element", object: element, locals: {in_grid: true} %>
<% previous_element = element %>
<% end %>
<% end %>
<%- end -%>