Sha256: 78b66274eef9b5934a9244cb19d69a60384f179659d2595d5072b2315e15f35c
Contents?: true
Size: 685 Bytes
Versions: 7
Compression:
Stored size: 685 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) if Rails.version < '5.0.0' redirect_to :back, notice: I18n.t("acts_as_published.notices.#{action_taken}", name: resource_label) else flash[:notice] = I18n.t("acts_as_published.notices.#{action_taken}", name: resource_label) redirect_back(fallback_location: main_app.root_path) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems