Sha256: e0886832a76182877ffcc44a1f6042b451c12b64e775c42bf5c96a203b77bd6f

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require 'active_support/concern'

module ResourceRow
  module PublishedExtensions
    extend ActiveSupport::Concern

    def column_published_actions
      link_path = view_context.controller.url_for(action: :toggle_published, id: resource.to_param)
      column(:column_published_actions) do |resource|
        if resource.published?
          view_context.button_to(link_path, class: 'btn btn-xs btn-danger btn-responsive', method: :post) do
            view_context.content_tag(:span, nil, class: 'glyphicon glyphicon-eye-close') +
              view_context.content_tag(:span, view_context.t('.unpublish', default: view_context.t('acts_as_published.actions.unpublish')), class: 'btn-text')
          end
        else
          view_context.button_to(link_path, class: 'btn btn-xs btn-success btn-responsive', method: :post) do
            view_context.content_tag(:span, nil, class: 'glyphicon glyphicon-eye-open') +
              view_context.content_tag(:span, view_context.t('.publish', default: view_context.t('acts_as_published.actions.publish')), class: 'btn-text')
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
itsf_backend-5.0.0.pre app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-4.2.3 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-4.2.2 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-4.2.1 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-4.2.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-4.0.1 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-4.0.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.1.1 app/extensions/concerns/resource_row/published_extensions.rb