Class: ForemanPatch::GroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanPatch::GroupsController
- Includes:
- Foreman::Controller::AutoCompleteSearch, Foreman::Controller::CsvResponder
- Defined in:
- app/controllers/foreman_patch/groups_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #csv_columns ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #resource_class ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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_columns ⇒ Object
57 58 59 |
# File 'app/controllers/foreman_patch/groups_controller.rb', line 57 def csv_columns [:name, :label, :default_window_plan, :hosts_count] end |
#destroy ⇒ Object
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 |
#edit ⇒ Object
34 35 |
# File 'app/controllers/foreman_patch/groups_controller.rb', line 34 def edit end |
#index ⇒ Object
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 |
#new ⇒ Object
21 22 23 |
# File 'app/controllers/foreman_patch/groups_controller.rb', line 21 def new @group = Group.new end |
#resource_class ⇒ Object
53 54 55 |
# File 'app/controllers/foreman_patch/groups_controller.rb', line 53 def resource_class ForemanPatch::Group end |
#update ⇒ Object
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 |