app/controllers/pageflow/revisions_controller.rb in pageflow-15.1.0.beta2 vs app/controllers/pageflow/revisions_controller.rb in pageflow-15.1.0.beta3
- old
+ new
@@ -1,22 +1,28 @@
module Pageflow
class RevisionsController < Pageflow::ApplicationController
+ include ControllerDelegation
include QuotaVerification
- before_action :authenticate_user!, :unless => lambda { |controller| controller.request.format.css? }
+ before_action :authenticate_user!, except: [:stylesheet]
respond_to :json
def show
revision = Revision.find(params[:id])
- authorize!(:show, revision) unless request.format.css?
+ authorize!(:show, revision)
+ entry = PublishedEntry.new(revision.entry, revision)
+ delegate_to_entry_type_frontend_app!(entry)
+ end
+
+ def stylesheet
+ revision = Revision.find(params[:id])
+
@entry = PublishedEntry.new(revision.entry, revision)
- I18n.locale = @entry.locale
- @widget_scope = :preview
- render :template => 'pageflow/entries/show'
+ render template: 'pageflow/entries/stylesheet'
end
def depublish_current
entry = Entry.find(params[:entry_id])
authorize!(:publish, entry)
@@ -27,8 +33,13 @@
private
def revision_params
params.fetch(:revision, {}).permit(:published_until)
+ end
+
+ def delegate_to_entry_type_frontend_app!(entry)
+ EntriesControllerEnvHelper.add_entry_info_to_env(request.env, entry: entry, mode: :preview)
+ delegate_to_rack_app!(entry.entry_type.frontend_app)
end
end
end