Class: ForemanUsers::SygroupsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_users/sygroups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /sygroups POST /sygroups.json



41
42
43
44
45
46
47
48
49
50
51
# File 'app/controllers/foreman_users/sygroups_controller.rb', line 41

def create
  @sygroup = ForemanUsers::Sygroup.new(params[:foreman_users_sygroup])

  respond_to do |format|
    if @sygroup.save
      format.js
    else
      format.js { render :template => 'layouts/error', locals: { errors: @syusers.errors } }
    end
  end
end

#destroyObject

DELETE /sygroups/1 DELETE /sygroups/1.json



70
71
72
73
74
75
76
77
78
# File 'app/controllers/foreman_users/sygroups_controller.rb', line 70

def destroy
  @sygroup = ForemanUsers::Sygroup.find(params[:id])
  @sygroup.destroy
  respond_to do |format|
    format.js
  end


end

#editObject

GET /sygroups/1/edit



35
36
37
# File 'app/controllers/foreman_users/sygroups_controller.rb', line 35

def edit
  @sygroup = ForemanUsers::Sygroup.find(params[:id])
end

#indexObject

GET /sygroups GET /sygroups.json



4
5
6
7
8
9
10
11
# File 'app/controllers/foreman_users/sygroups_controller.rb', line 4

def index
  @sygroups = ForemanUsers::Sygroup.all.paginate(:page => params[:page])

  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @sygroups }
  end
end

#newObject

GET /sygroups/new GET /sygroups/new.json



26
27
28
29
30
31
32
# File 'app/controllers/foreman_users/sygroups_controller.rb', line 26

def new
  usermodel = ForemanUsers::Syusermodel.find(params[:syusermodel_id])
  @sygroup = usermodel.sygroups.new
  respond_to do |format|
    format.js
  end
end

#showObject

GET /sygroups/1 GET /sygroups/1.json



15
16
17
18
19
20
21
22
# File 'app/controllers/foreman_users/sygroups_controller.rb', line 15

def show
  @sygroup = ForemanUsers::Sygroup.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @sygroup }
  end
end

#updateObject

PUT /sygroups/1 PUT /sygroups/1.json



55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/controllers/foreman_users/sygroups_controller.rb', line 55

def update
  @sygroup = ForemanUsers::Sygroup.find(params[:id])

  respond_to do |format|
    if @sygroup.update_attributes(params[:foreman_users_sygroup])
      format.js
    else
      format.html { render action: "edit" }
      format.json { render json: @sygroup.errors, status: :unprocessable_entity }
    end
  end
end