Sha256: 525b400afe0ae69f8ff84984b7eb0d79b94c5b5fb1c4aff98c429ad65d5c3de4

Contents?: true

Size: 774 Bytes

Versions: 2

Compression:

Stored size: 774 Bytes

Contents

unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
  class EffectivePostsDatatable < Effective::Datatable
    datatable do
      order :published_at, :desc

      col :published_at
      col :id, visible: false

      col :title
      col :category, search: { collection: EffectivePosts.categories }

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

        col :draft, visible: false
      else
        col :draft
      end

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

      actions_col partial: '/admin/posts/actions', partial_as: :post
    end

    collection do
      Effective::Post.all
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
effective_posts-0.5.3 app/datatables/effective_posts_datatable.rb
effective_posts-0.5.2 app/datatables/effective_posts_datatable.rb