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.6.12 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.11 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.10 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.9 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.8 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.7 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.6 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.5 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.4 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.3 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.2 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.1 lib/scaffolds/datatables/datatable.rb
effective_developer-0.6.0 lib/scaffolds/datatables/datatable.rb