<% content_for :page_specific_css do %> <%= stylesheet_link_tag "universal_table/universal-table" %> <% end %>
<% @table_fields.each do |field| %> <% sort = field.to_s.include?('.') ? field.to_s.split('.')[1] : field.to_s active = params[:sort].eql? sort order = active ? (["asc", "desc"]-[params[:order]]).first : "asc" arrow = (order.eql? "desc") ? "" : "" klass = field.eql?(:title) ? "span5" : "span2" th_data = "#{field} #{active ? arrow : ""}" %> <% end %> <% @entries.each do |entry| %> <% @columns.each_with_index do |column, index| %> <% ce = entry.column_entries.where(:table_column_id => column.id).first rescue nil %> <% if !ce.nil? %> <% else %> <% end %> <% end %> <% end %>
<%= th_data.html_safe %>
<% case ce.type %> <% when "text" %> <%= ce.text %> <% when "editor" %> <%= ce.content.html_safe rescue "" %> <% when "image" %>
<% if !ce.image.nil? %> <% end %>
<% when "date" %> <%= format_date(ce.date, column.date_format) %> <% when "period" %> <% if !ce.period_from.nil? %> <%= format_date(ce.period_from, column.date_format) %> ~ <%= format_date(ce.period_to, column.date_format) %> <% end %> <% end %> <% if index == 0 %> <% end %>
 
<%= content_tag :div, paginate(@entries), class: "pagination pagination-centered" %>
Add Entry