diff --git a/app/views/admin/universal_tables/show.html.erb b/app/views/admin/universal_tables/show.html.erb index 08352c9..2f6d084 100644 --- a/app/views/admin/universal_tables/show.html.erb +++ b/app/views/admin/universal_tables/show.html.erb @@ -27,32 +27,35 @@ - <% can_edit = can_edit_or_delete?(@entries.first.u_table) if !(@entries.first.nil?) %> + <% 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 %> - <% if !ce.nil? %> + <% ce = entry.column_entries.where(:table_column_id => column.id).first rescue 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? %> - + <% 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 "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 %> + <% else %> +   <% end %> <% if index == 0 && can_edit %>
@@ -63,11 +66,6 @@
<% end %> - <% else %> - -   - - <% end %> <% end %> <% end %>