<%- if ['question_pages', 'question_sheets', 'elements'].include?(controller.controller_name) -%>
<%- else -%> <% headers = question_grid_with_total.cols.to_s.split(';') %> <% if headers.detect {|h| h.strip.present?} %> <%- headers.each do |header| -%> <%- end -%> <% end %> <%- col_count = 0 question_grid_with_total.elements.each do |element| -%> <%- col_count += 1 if col_count % question_grid_with_total.num_cols == 0 && element != question_grid_with_total.elements.last then col_count = 0 -%><%- end -%> <%- end -%> <%- while col_count < question_grid_with_total.num_cols do col_count += 1-%> <%- end unless col_count == 0-%> <%- if question_grid_with_total.total_cols.present? -%> <%- total_cols = question_grid_with_total.total_cols.split(',').collect(&:to_i) (question_grid_with_total.num_cols - 1).times do |i| ci = i + 2 if total_cols.include?(ci) -%> <% else %> <% end %> <%- end -%> <%- end -%>
<%= header || ' ' %>
<%# grid_el = @elements.to_a.find {|el| el.id == element.id} %> <% col_count = (col_count + 1) % question_grid_with_total.num_cols %> <%= render :partial => 'fe/answer_pages/element', :object => element, :locals => {:in_grid => true, :col => col_count} %>
 
Total <%= text_field_tag "total_#{question_grid_with_total.id}_#{i + 1}", '', :class => 'text validate-number', :readonly => true %>  
<%- end -%>