Sha256: 3a64f9bcf6c8e8eff0ef4f29abe01e6df317f059060d5d113e15538c4809bc7b

Contents?: true

Size: 904 Bytes

Versions: 3

Compression:

Stored size: 904 Bytes

Contents

class <%= resource.namespaced_class_name.pluralize %>Datatable < Effective::Datatable

  bulk_actions do
    bulk_action 'Delete selected', <%= [resource.namespaces, resource, 'path'].flatten.compact.join('_') %>(:ids), data: { method: :delete, confirm: 'Really delete selected?' }
  end

  datatable do
    order :updated_at

    bulk_actions_col

    col :updated_at, visible: false
    col :created_at, visible: false
    col :id, visible: false

<% if resource.belong_tos.present? || resource.has_anys.present? -%>
<% resource.belong_tos.each do |reference| -%>
    col :<%= reference.name %>
<% end -%>
<% resource.has_anys.each do |reference| -%>
    col :<%= reference.name %>
<% end -%>

<% end -%>
<% attributes.except(:created_at, :updated_at, :id).each do |name, _| -%>
    col :<%= name %>
<% end -%>

    actions_col
  end

  collection do
    <%= resource.class_name %>.deep.all
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
effective_developer-0.4.3 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.2 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.1 lib/scaffolds/datatables/datatable.rb