% exceptions ||= ['created_at', 'updated_at', 'deleted_at'] %> <% excluded_columns ||= [] %> <% additional_columns ||= [] %> <% additional_actions ||= [] %> <% hide_actions ||= false %> <% sort_fields ||= [] %> <% sort_all ||= false %> <% table_class ||= 'datatables styletable' %> <% box_class ||= 'primary' %> <% show_columns ||= [] %> <% hide_read_action ||= false %> <% hide_edit_action ||= false %> <% hide_destroy_action ||= false %> <% if show_columns.empty? %> <% show_columns = list.klass.column_names - exceptions - excluded_columns + additional_columns %> <% end %>
<%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_id")[0])) %> | <% elsif /_cents$/ =~ column %><%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_cents")[0])) %> | <% elsif /_currency$/ =~ column %> <% else %><%= sort_link(@q, column, list.klass.human_attribute_name(column)) %> | <% end %> <% else %> <% if /_id$/ =~ column %><%= list.klass.human_attribute_name(column.split("_id")[0]) %> | <% elsif /_cents$/ =~ column %><%= list.klass.human_attribute_name(column.split("_cents")[0]) %> | <% elsif /_currency$/ =~ column %> <% else %><%= list.klass.human_attribute_name(column) %> | <% end %> <% end %> <% end %> <% unless hide_actions %>Ações | <% end %>
---|---|---|---|---|---|---|
<% if column.include?('.') %> <% o = object %> <% column.split('.').each{|m| o = o.send(m) if o } %> <%= o %> <% elsif object.send(column).class == Date or object.send(column).class == DateTime or object.send(column).class == ActiveSupport::TimeWithZone or object.send(column).class == Time %> <%=l object.send(column) %> <% elsif object.send(column).respond_to? 'attached?' %> <% if object.send(column).class == ActiveStorage::Attached::One %> <% if object.send(column).attached? %> <%= link_to rails_blob_path(object.send(column)), class: "btn btn-#{box_class} btn-xs", target: '_blank' do %> Arquivo <% end %> <% end %> <% end %> <% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %> <%= object.send(column.split("_id")[0])&.name %> <% elsif /_cents$/ =~ column %> <%= number_to_currency object.send(column.split("_cents")[0]) %> <% elsif /_currency$/ =~ column %> <% elsif column.include?(".") %> <%= eval("object.#{column}") %> <% elsif column == 'id' %> <%= link_to object.id, object %> <% else %> <%= object.send(column) %> <% end %> | <% end %> <% unless hide_actions %><%= render 'shared/action_links', object: object, additional_actions: additional_actions, hide_read_action: hide_read_action, hide_edit_action: hide_edit_action, hide_destroy_action: hide_destroy_action %> | <% end %>