Sha256: 027060356fc80289fcaa194c55520643ae498a098ebb39f865ba2fa30a91b66b

Contents?: true

Size: 468 Bytes

Versions: 38

Compression:

Stored size: 468 Bytes

Contents

module Controller
  module ActsAsPublishedConcern
    extend ActiveSupport::Concern

    def toggle_published
      @resource = load_resource
      @resource.toggle_published!
      action_taken = @resource.published? ? 'published' : 'unpublished'
      resource_label = @resource.try_all(*Itsf::Backend::Configuration.resource_title_methods)
      redirect_to :back, notice: I18n.t("acts_as_published.notices.#{action_taken}", name: resource_label)
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
itsf_backend-3.1.0 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.7 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.6 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.5 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.4 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.3 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.2 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.1 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-3.0.0 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-2.2.1 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-2.2.0 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-2.1.0 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-2.0.2 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-2.0.1 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-1.2.8 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-1.2.7 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-1.2.6 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-1.2.5 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-1.2.4 app/controllers/concerns/controller/acts_as_published_concern.rb
itsf_backend-1.2.1 app/controllers/concerns/controller/acts_as_published_concern.rb