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-3.1.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.7 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.6 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.5 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.4 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.3 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.2 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.1 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-3.0.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-2.2.1 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-2.2.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-2.1.0 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-2.0.2 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-2.0.1 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.2.8 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.2.7 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.2.6 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.2.5 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.2.4 app/extensions/concerns/resource_row/published_extensions.rb
itsf_backend-1.2.1 app/extensions/concerns/resource_row/published_extensions.rb