Sha256: 0d89088ebaf4207a04021c1e51e65fdd33c8f8f0cc158ded247dda3fc8c473cd

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 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.acquire(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

1 entries across 1 versions & 1 rubygems

Version Path
pageflow-0.10.0 admins/pageflow/revisions.rb