Sha256: 55cc8db3b80dc33a4163d7aac0e9ef05d6bcf6c1c8b574e9c001fea5c28d08e3

Contents?: true

Size: 974 Bytes

Versions: 5

Compression:

Stored size: 974 Bytes

Contents

module Pageflow
  class RevisionsController < Pageflow::ApplicationController
    before_filter :authenticate_user!, :unless => lambda { |controller| controller.request.format.css? }

    respond_to :json

    def create
      entry = Entry.find(params[:entry_id])
      authorize!(:publish, entry)
      verify_edit_lock!(entry)
      @revision = entry.publish(revision_params.merge(:creator => current_user))
    end

    def show
      revision = Revision.find(params[:id])
      authorize!(:show, revision) unless request.format.css?

      @entry = PublishedEntry.new(revision.entry, revision)
      render :template => 'pageflow/entries/show'
    end

    def depublish_current
      entry = Entry.find(params[:entry_id])
      authorize!(:publish, entry)

      entry.revisions.depublish_all
      redirect_to(main_app.admin_entry_path(entry))
    end

    private

    def revision_params
      params.fetch(:revision, {}).permit(:published_until)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pageflow-0.0.5 app/controllers/pageflow/revisions_controller.rb
pageflow-0.0.4 app/controllers/pageflow/revisions_controller.rb
pageflow-0.0.3 app/controllers/pageflow/revisions_controller.rb
pageflow-0.0.2 app/controllers/pageflow/revisions_controller.rb
pageflow-0.0.1 app/controllers/pageflow/revisions_controller.rb