Sha256: 36e563db287a2efe95a1bcab5cdc52e7ae611f781a2da00072a34d83f996249b

Contents?: true

Size: 807 Bytes

Versions: 9

Compression:

Stored size: 807 Bytes

Contents

module Pageflow
  ActiveAdmin.register Revision, :as => 'Revision' do
    menu false

    actions :edit, :update, :show

    form :partial => 'form'

    member_action :restore, :method => :post do
      revision = Revision.find(params[:id])
      entry = revision.entry
      authorize!(:restore, entry)

      entry.edit_lock.aquire(current_user)
      revision.entry.restore(:revision => revision, :creator => current_user)
      entry.edit_lock.release(current_user)

      redirect_to(admin_entry_path(entry, :notice => I18n.t('pageflow.admin.revisions.restored')))
    end

    controller do
      include EditLocking

      def permitted_params
        params.permit(:revision => [:published_until])
      end

      def show
        redirect_to([:admin, resource.entry])
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pageflow-0.9.2 admins/pageflow/revisions.rb
pageflow-0.9.1 admins/pageflow/revisions.rb
pageflow-0.9.0 admins/pageflow/revisions.rb
pageflow-0.8.2 admins/pageflow/revisions.rb
pageflow-0.8.1 admins/pageflow/revisions.rb
pageflow-0.8.0 admins/pageflow/revisions.rb
pageflow-0.7.2 admins/pageflow/revisions.rb
pageflow-0.7.1 admins/pageflow/revisions.rb
pageflow-0.7.0 admins/pageflow/revisions.rb