Sha256: 0a9fec82d1ba4a9553e93b9f32b33df59548712f175146ef41538c826ce990ef

Contents?: true

Size: 1.25 KB

Versions: 15

Compression:

Stored size: 1.25 KB

Contents

module Rao
  module Component
    # Basic usage:
    #
    #     # app/views/pictures/index.html.haml
    #     = collection_table(collection: @pictures) do |table|
    #       = table.acts_as_published_actions
    #
    # You will have to add a publishing route to your resource:
    #
    #     # config/routes.rb:
    #     Rails.application.routes do
    #       resources :picture do
    #         post :toggle_published, on: :member
    #       end
    #       # ...
    #     end
    #
    # Additionally you will need a controller action to handle the reponsitioning.
    # Include Rao::ResourcesController::ActsAsPublishedConcern from rao-resource_controller
    # if you don't want to implement it yourself:
    #
    #     # app/controllers/pictures_controller.rb
    #     class PicturesController < ApplicationController
    #       include Rao::ResourcesController::ActsAsPublishedConcern
    #       # ...
    #     end
    #
    module CollectionTable::ActsAsPublishedConcern
      extend ActiveSupport::Concern

      def acts_as_published_actions(options = {}, &block)
        options.reverse_merge!(render_as: :acts_as_published, title: t('.column_titles.acts_as_published'))
        column(:acts_as_published_actions, options, &block)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rao-component-0.0.17.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.16.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.15.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.14.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.13.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.12.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.11.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.10.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.9.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.8.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.7.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.6.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.5.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.4.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb
rao-component-0.0.3.pre app/concerns/rao/component/collection_table/acts_as_published_concern.rb