Sha256: 59d7ec513c6fd727600b61ac57051b4da63de889a15993a10b5f224541b3cf78

Contents?: true

Size: 1006 Bytes

Versions: 2

Compression:

Stored size: 1006 Bytes

Contents

if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
  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

2 entries across 2 versions & 1 rubygems

Version Path
effective_posts-0.5.3 app/models/effective/datatables/posts.rb
effective_posts-0.5.2 app/models/effective/datatables/posts.rb