Sha256: 4a8de349fea816d421cf53e50fb3ea0e39e445ed06dd8252c3e5d808a05a8068

Contents?: true

Size: 963 Bytes

Versions: 3

Compression:

Stored size: 963 Bytes

Contents

if defined?(EffectiveDatatables)
  module Effective
    module Datatables
      class Posts < Effective::Datatable
        datatable do
          default_order :published_at, :desc

          table_column :published_at
          table_column :id, visible: false

          table_column :title
          table_column :category, filter: { type: :select, values: EffectivePosts.categories }

          if EffectivePosts.submissions_enabled
            table_column :approved, column: 'NOT(draft)', as: :boolean do |post|
              post.draft ? 'No' : 'Yes'
            end

            table_column :draft, visible: false
          else
            table_column :draft
          end

          table_column :created_at, label: 'Submitted at', visible: false

          table_column :actions, sortable: false, filter: false, partial: '/admin/posts/actions'
        end

        def collection
          Effective::Post.all
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
effective_posts-0.5.1 app/models/effective/datatables/posts.rb
effective_posts-0.5.0 app/models/effective/datatables/posts.rb
effective_posts-0.4.7 app/models/effective/datatables/posts.rb