Sha256: a6fd70c26811bbc2e34852409e33ec242d607be34fd57f2b72ecf8310334bf7e

Contents?: true

Size: 1.1 KB

Versions: 38

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.link_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.link_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

38 entries across 38 versions & 1 rubygems

Version Path
itsf_backend-1.2.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.15 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.14 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.13 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.12 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.11 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.10 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.9 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.8 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.7 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.6 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.5 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.4 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.3 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.2 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.1 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.1.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.0.1 app/extensions/concerns/resource_row/published_extensions.rb