Sha256: 008ce3e80e04c4833ca4cca67520790054f029af2f1b1a041dee05ccc33dc003

Contents?: true

Size: 1008 Bytes

Versions: 18

Compression:

Stored size: 1008 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, :archived).each do |name, _| -%>
    col :<%= name %>
<% end -%>
<% if attributes.key?(:archived) -%>

    col :archived, search: { value: false }
<% end -%>

    actions_col
  end

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

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
effective_developer-0.5.4 lib/scaffolds/datatables/datatable.rb
effective_developer-0.5.3 lib/scaffolds/datatables/datatable.rb
effective_developer-0.5.2 lib/scaffolds/datatables/datatable.rb
effective_developer-0.5.1 lib/scaffolds/datatables/datatable.rb
effective_developer-0.5.0 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.16 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.15 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.14 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.13 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.12 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.11 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.10 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.9 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.8 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.7 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.6 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.5 lib/scaffolds/datatables/datatable.rb
effective_developer-0.4.4 lib/scaffolds/datatables/datatable.rb