Class: ForemanPatch::GroupsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Foreman::Controller::AutoCompleteSearch, Foreman::Controller::CsvResponder
Defined in:
app/controllers/foreman_patch/groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



25
26
27
28
29
30
31
32
# File 'app/controllers/foreman_patch/groups_controller.rb', line 25

def create
  @group = Group.new(group_params)
  if @group.save
    process_success object: @group
  else
    process_error object: @group
  end
end

#csv_columnsObject



57
58
59
# File 'app/controllers/foreman_patch/groups_controller.rb', line 57

def csv_columns
  [:name, :label, :default_window_plan, :hosts_count]
end

#destroyObject



45
46
47
48
49
50
51
# File 'app/controllers/foreman_patch/groups_controller.rb', line 45

def destroy
  if @group.destroy
    process_success object: @group
  else
    process_error object: @group
  end
end

#editObject



34
35
# File 'app/controllers/foreman_patch/groups_controller.rb', line 34

def edit
end

#indexObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/foreman_patch/groups_controller.rb', line 9

def index
  respond_to do |format|
    format.html do
      @groups = resource_base_search_and_page
      render :index
    end
    format.csv do
      csv_response(resource_base_with_search)
    end
  end
end

#newObject



21
22
23
# File 'app/controllers/foreman_patch/groups_controller.rb', line 21

def new
  @group = Group.new
end

#resource_classObject



53
54
55
# File 'app/controllers/foreman_patch/groups_controller.rb', line 53

def resource_class
  ForemanPatch::Group
end

#updateObject



37
38
39
40
41
42
43
# File 'app/controllers/foreman_patch/groups_controller.rb', line 37

def update
  if @group.update(group_params)
    process_success object: @group
  else
    process_error object: @group
  end
end