<% 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 %> <% can_edit = can_edit_or_delete?(@table) %> <% @entries.each do |entry| %> <% @columns.each_with_index do |column, index| %> <% ce = entry.column_entries.where(:table_column_id => column.id).first rescue nil %> <% end %> <% end %>
<%= th_data.html_safe %>
<% if !ce.nil? %> <% case ce.type %> <% when "text" %> <%= ce.text %> <% when "integer" %> <%= ce.number %> <% 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 %> <% when "file" %> <% locale = I18n.locale.to_s %>
    <% ce.column_entry_files.desc(:sort_number).each do |entry_file| %> <% next unless entry_file.choose_lang_display(locale) %>
  1. <%= link_to entry_file.get_file_title, entry_file.file.url, target: "_blank" %>
  2. <% end %>
<% end %> <% else %>   <% end %> <% if index == 0 && can_edit %> <% end %>
<%= content_tag :div, paginate(@entries), class: "pagination pagination-centered" %>
Add Entry