Class: AutosignController

Inherits:
ApplicationController show all
Defined in:
app/controllers/autosign_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#createObject


20
21
22
23
24
25
26
# File 'app/controllers/autosign_controller.rb', line 20

def create
  if @api.set_autosign(params[:id])
    process_success({:success_redirect => smart_proxy_autosign_index_path(@proxy), :object_name => 'puppet autosign entry'})
  else
    process_error({:redirect => smart_proxy_autosign_index_path(@proxy)})
  end
end

#destroyObject


28
29
30
31
32
33
34
# File 'app/controllers/autosign_controller.rb', line 28

def destroy
  if @api.del_autosign(params[:id])
    process_success({:success_redirect => smart_proxy_autosign_index_path(@proxy), :object_name => 'puppet autosign entry'})
  else
    process_error({:redirect => smart_proxy_autosign_index_path(@proxy)})
  end
end

#indexObject


4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/autosign_controller.rb', line 4

def index
  begin
    autosign = @api.autosign
  rescue => e
    autosign = []
    error e
  end
  respond_to do |format|
    format.html { @autosign = autosign.paginate :page => params[:page], :per_page => 20 }
    format.json {render :json => autosign }
  end
end

#newObject


17
18
# File 'app/controllers/autosign_controller.rb', line 17

def new
end