Sha256: 3686a3204f9220cc72002049387f3039f1f46c31e0f6f8b0b616109926de488e

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

class EffectivePostsDatatable < Effective::Datatable
  bulk_actions do
    bulk_action('Archive selected', effective_posts.bulk_archive_admin_posts_path)
    bulk_action('Unarchive selected', effective_posts.bulk_unarchive_admin_posts_path)
  end

  filters do
    scope :unarchived, label: 'All'
    scope :published
    scope :draft
    scope :news
    scope :events
    scope :archived
  end

  datatable do
    order :published_start_at, :desc

    bulk_actions_col

    col :id, visible: false

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

    col :draft?, as: :boolean, visible: false
    col :published?, as: :boolean
    col :published_start_at, label: "Published start"
    col :published_end_at, label: "Published end"
    col :roles

    col :archived

    col :start_at, visible: EffectivePosts.categories.include?('Events')
    col :end_at, visible: false
    col :location, visible: false
    col :created_at, label: 'Submitted at', visible: false

    actions_col do |post|
      dropdown_link_to('View', effective_post_path(post), target: '_blank')
    end
  end

  collection do
    Effective::Post.all
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
effective_posts-2.9.1 app/datatables/effective_posts_datatable.rb
effective_posts-2.9.0 app/datatables/effective_posts_datatable.rb