Sha256: 7e34a47d8363a964e92c7a5b1dad3c28714ca08829181a8890541cc35c08f1ea

Contents?: true

Size: 1.64 KB

Versions: 33

Compression:

Stored size: 1.64 KB

Contents

<% if resource.module_name.present? -%>
module <%= resource.module_name %>
  class <%= resource.module_namespaced %>Datatable < Effective::Datatable
    datatable do
      order :updated_at

      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
end
<% else -%>
class <%= resource.namespaced_class_name.pluralize %>Datatable < Effective::Datatable
  datatable do
    order :updated_at

    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
<% end -%>

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
effective_developer-0.8.5 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.8.4 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.8.3 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.8.2 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.8.1 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.8.0 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.8 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.7 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.6 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.5 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.4 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.3 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.2 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.1 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.7.0 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.6.17 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.6.16 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.6.15 lib/scaffolds/basic/datatables/datatable.rb
effective_developer-0.6.14 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.13 lib/scaffolds/datatables/datatable.rb