Sha256: 5bd2c092948503012254a4526a408f566b727090aafbd45a0de6820973f7ed05

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 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
    col :published_end_at

    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

1 entries across 1 versions & 1 rubygems

Version Path
effective_posts-2.7.0 app/datatables/effective_posts_datatable.rb