Sha256: 7d32eee988b9a3e5ea91d6c8178fe48fe216563c410b96841a471d7c8d2ba30a
Contents?: true
Size: 1.23 KB
Versions: 68
Compression:
Stored size: 1.23 KB
Contents
module Pageflow module EditLocking extend ActiveSupport::Concern included do rescue_from EditLock::NotHeldError, EditLock::HeldByOtherSessionError do |exception| respond_to do |format| format.html { redirect_back fallback_location: admin_root_path, :alert => t('pageflow.edit_locks.required') } format.json do render(:status => :conflict, :json => { :error_message => exception.message, :error => exception.code }) end end end rescue_from EditLock::HeldByOtherUserError do |exception| respond_to do |format| format.html { redirect_back fallback_location: admin_root_path, :alert => t('pageflow.edit_locks.required_but_held_by_other_user') } format.json do render(:status => :conflict, :json => { :error_message => exception.message, :error => exception.code, :held_by => exception.user.full_name }) end end end end protected def verify_edit_lock!(entry) entry.edit_lock.verify!(current_user, :id => request.headers['X-Edit-Lock']) end end end
Version data entries
68 entries across 68 versions & 1 rubygems