Sha256: cc2f768f767db9ac6d40d0c9cfa12b2168948d773515ef128405ec5d978c22e7

Contents?: true

Size: 931 Bytes

Versions: 11

Compression:

Stored size: 931 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) unless entry.feature_state('no_edit_lock_snapshot')

      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

11 entries across 11 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/controllers/pageflow/edit_locks_controller.rb
pageflow-17.0.3 app/controllers/pageflow/edit_locks_controller.rb
pageflow-17.0.2 app/controllers/pageflow/edit_locks_controller.rb
pageflow-17.0.1 app/controllers/pageflow/edit_locks_controller.rb
pageflow-17.0.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-16.2.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-16.1.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-16.0.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.8.0 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.7.1 app/controllers/pageflow/edit_locks_controller.rb
pageflow-15.7.0 app/controllers/pageflow/edit_locks_controller.rb