Sha256: 70fcf490337fd82267c2e82e655ef4dd7420d582f59288a25f59839053d441f7

Contents?: true

Size: 965 Bytes

Versions: 3

Compression:

Stored size: 965 Bytes

Contents

<%
  def presenter_by_col(attribute)
    type = model.columns_hash[attribute.to_s].type
    return 'item.user.try(:name)' if [:user_id, :user].include?(attribute.to_sym)
    case type
      when :date, :datetime, :time
        "pretty_data item.#{attribute}"
      when :boolean
        "color_bool item.#{attribute}"
      else
        "item.#{attribute}"
    end
  end

%>
table.table.table-striped.index_table#list
  thead
    tr.pjax_links
      = batch_action_toggle
<% attrs = model_instance.attributes.keys.without(*(translated_columns + %w(updated_at)).map(&:to_s)) -%>
<% attrs.each do |attribute| -%>
      th= sort_link(@search, :<%= attribute -%>)
<% end -%>
      th= t 'admin.table.actions'
  tbody
    - collection.each do |item|
      tr
        = batch_action_item(item)
        td= id_link(item)
<% attrs.without('id').each do |attribute| -%>
        td= <%= presenter_by_col(attribute) %>
<% end -%>
        td.actions= item_index_actions(item)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ab_admin-0.1.2 lib/generators/ab_admin/resource/templates/_table.slim.erb
ab_admin-0.1.1 lib/generators/ab_admin/resource/templates/_table.slim.erb
ab_admin-0.1.0 lib/generators/ab_admin/resource/templates/_table.slim.erb