1class Admin::LocksController < Admin::AdminController
 
2  before_action :fetch_petition
 
3
 
4  def show
 
5    @petition.update_lock!(current_user)
 
6
 
7    respond_to do |format|
 
8      format.json
 
 9    end
 
10  end
 
 
12  def create
 
13    @petition.checkout!(current_user)
 
 
15    respond_to do |format|
 
16      format.json
 
17    end
 
18  end
 
 
20  def update
 
21    @petition.force_checkout!(current_user)
 
 
23    respond_to do |format|
 
24      format.json
 
25    end
 
26  end
 
 
28  def destroy
 
29    @petition.release!(current_user)
 
 
31    respond_to do |format|
 
32      format.json
 
33    end
 
34  end
 
 
36  private
 
 
38  def last_request_update_allowed?
 
39    false
 
40  end
 
 
42  def fetch_petition
 
43    @petition = Petition.find(params[:petition_id])
 
44  end
 
45end