Sha256: e9f5a84591f6d1944ce6587b55c114f0638ccd79c44b9acaf137764eff2760ca

Contents?: true

Size: 880 Bytes

Versions: 57

Compression:

Stored size: 880 Bytes

Contents

module Pageflow
  class EditLocksController < Pageflow::ApplicationController
    before_action :authenticate_user!

    respond_to :json

    def create
      entry = Entry.find(params[:entry_id])
      authorize!(:edit, entry)
      entry.edit_lock.acquire(current_user, edit_lock_params)
      entry.snapshot(:creator => current_user)
      respond_with(entry.reload.edit_lock, :location => entry_edit_lock_url(entry))
    end

    def update
      entry = Entry.find(params[:entry_id])
      authorize!(:edit, entry)
      entry.edit_lock.acquire(current_user, edit_lock_params)
      head :no_content
    end

    def destroy
      entry = Entry.find(params[:entry_id])
      entry.edit_lock.release(current_user)
      head :no_content
    end

    protected

    def edit_lock_params
      params.permit(:edit_lock => [:force, :id]).fetch(:edit_lock, {})
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.6.1 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.6.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.5.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.4.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.3.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.2.2 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.2.1 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.2.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.2 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.1 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0.rc0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0.beta6 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0.beta5 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0.beta4 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0.beta3 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0.beta2 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.1.0.beta1 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.0.2 app/controllers/pageflow/edit_locks_controller.rb