Class: Admin::FieldGroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::FieldGroupsController
- Defined in:
- app/controllers/admin/field_groups_controller.rb
Overview
Copyright © 2008-2013 Michael Dvorkin and contributors.
Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php
Instance Method Summary collapse
-
#confirm ⇒ Object
GET /admin/field_groups/1/confirm AJAX —————————————————————————-.
-
#create ⇒ Object
POST /admin/field_groups POST /admin/field_groups.xml AJAX —————————————————————————-.
-
#destroy ⇒ Object
DELETE /admin/field_groups/1 DELETE /admin/field_groups/1.xml AJAX —————————————————————————-.
-
#edit ⇒ Object
GET /admin/field_groups/1/edit AJAX —————————————————————————-.
-
#new ⇒ Object
GET /admin/field_groups/new GET /admin/field_groups/new.xml AJAX —————————————————————————-.
-
#sort ⇒ Object
POST /admin/field_groups/sort —————————————————————————-.
-
#update ⇒ Object
PUT /admin/field_groups/1 PUT /admin/field_groups/1.xml AJAX —————————————————————————-.
Instance Method Details
#confirm ⇒ Object
GET /admin/field_groups/1/confirm AJAX
76 77 78 |
# File 'app/controllers/admin/field_groups_controller.rb', line 76 def confirm @field_group = FieldGroup.find(params[:id]) end |
#create ⇒ Object
POST /admin/field_groups POST /admin/field_groups.xml AJAX
35 36 37 38 39 |
# File 'app/controllers/admin/field_groups_controller.rb', line 35 def create @field_group = FieldGroup.create(field_group_params) respond_with(@field_group) end |
#destroy ⇒ Object
DELETE /admin/field_groups/1 DELETE /admin/field_groups/1.xml AJAX
54 55 56 57 58 59 |
# File 'app/controllers/admin/field_groups_controller.rb', line 54 def destroy @field_group = FieldGroup.find(params[:id]) @field_group.destroy respond_with(@field_group) end |
#edit ⇒ Object
GET /admin/field_groups/1/edit AJAX
22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/admin/field_groups_controller.rb', line 22 def edit @field_group = FieldGroup.find(params[:id]) if params[:previous].to_s =~ /(\d+)\z/ @previous = FieldGroup.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i end respond_with(@field_group) end |
#new ⇒ Object
GET /admin/field_groups/new GET /admin/field_groups/new.xml AJAX
14 15 16 17 18 |
# File 'app/controllers/admin/field_groups_controller.rb', line 14 def new @field_group = FieldGroup.new(klass_name: params[:klass_name]) respond_with(@field_group) end |
#sort ⇒ Object
POST /admin/field_groups/sort
63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/admin/field_groups_controller.rb', line 63 def sort asset = params[:asset] field_group_ids = params["#{asset}_field_groups"] field_group_ids.each_with_index do |id, index| FieldGroup.where(id: id).update_all(position: index + 1) end render nothing: true end |
#update ⇒ Object
PUT /admin/field_groups/1 PUT /admin/field_groups/1.xml AJAX
44 45 46 47 48 49 |
# File 'app/controllers/admin/field_groups_controller.rb', line 44 def update @field_group = FieldGroup.find(params[:id]) @field_group.update_attributes(field_group_params) respond_with(@field_group) end |