<% 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 %> <% show_columns.each do |column| %> <% if sort_all || sort_fields.include?(column) %> <% if /_id$/ =~ column %> <% elsif /_cents$/ =~ column %> <% elsif /_currency$/ =~ column %> <% else %> <% end %> <% else %> <% if /_id$/ =~ column %> <% elsif /_cents$/ =~ column %> <% elsif /_currency$/ =~ column %> <% else %> <% end %> <% end %> <% end %> <% unless hide_actions %> <% end %> <% list.each do |object| %> <% show_columns.each do |column| %> <% next if /_currency$/ =~ column %> <% end %> <% unless hide_actions %> <% end %> <% end %>
<%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_id")[0])) %><%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_cents")[0])) %><%= sort_link(@q, column, list.klass.human_attribute_name(column)) %><%= list.klass.human_attribute_name(column.split("_id")[0]) %><%= list.klass.human_attribute_name(column.split("_cents")[0]) %><%= list.klass.human_attribute_name(column) %>Ações
<% 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 %> <%= 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 %>