Class: EntitiesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- EntitiesController
- Defined in:
- app/controllers/entities_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
Direct Known Subclasses
AccountsController, CampaignsController, ContactsController, LeadsController, OpportunitiesController
Instance Method Summary collapse
-
#attach ⇒ Object
Common attach handler for all core controllers.
-
#contacts ⇒ Object
GET /entities/contacts AJAX —————————————————————————-.
-
#discard ⇒ Object
Common discard handler for all core controllers.
-
#field_group ⇒ Object
—————————————————————————-.
-
#leads ⇒ Object
GET /entities/leads AJAX —————————————————————————-.
-
#opportunities ⇒ Object
GET /entities/opportunities AJAX —————————————————————————-.
-
#subscribe ⇒ Object
Common subscribe handler for all core controllers.
-
#unsubscribe ⇒ Object
Common unsubscribe handler for all core controllers.
-
#versions ⇒ Object
GET /entities/versions AJAX —————————————————————————-.
Methods inherited from ApplicationController
Instance Method Details
#attach ⇒ Object
Common attach handler for all core controllers.
24 25 26 27 28 29 30 |
# File 'app/controllers/entities_controller.rb', line 24 def attach @attachment = params[:assets].classify.constantize.find(params[:asset_id]) @attached = entity.attach!(@attachment) entity.reload respond_with(entity) end |
#contacts ⇒ Object
GET /entities/contacts AJAX
66 67 |
# File 'app/controllers/entities_controller.rb', line 66 def contacts end |
#discard ⇒ Object
Common discard handler for all core controllers.
34 35 36 37 38 39 40 |
# File 'app/controllers/entities_controller.rb', line 34 def discard @attachment = params[:attachment].constantize.find(params[:attachment_id]) entity.discard!(@attachment) entity.reload respond_with(entity) end |
#field_group ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'app/controllers/entities_controller.rb', line 85 def field_group if @tag = Tag.find_by_name(params[:tag].strip) if @field_group = FieldGroup.find_by_tag_id_and_klass_name(@tag.id, klass.to_s) @asset = klass.find_by_id(params[:asset_id]) || klass.new render('fields/group') && return end end render plain: '' end |
#leads ⇒ Object
GET /entities/leads AJAX
71 72 |
# File 'app/controllers/entities_controller.rb', line 71 def leads end |
#opportunities ⇒ Object
GET /entities/opportunities AJAX
76 77 |
# File 'app/controllers/entities_controller.rb', line 76 def opportunities end |
#subscribe ⇒ Object
Common subscribe handler for all core controllers.
44 45 46 47 48 49 50 51 |
# File 'app/controllers/entities_controller.rb', line 44 def subscribe entity.subscribed_users += [current_user.id] entity.save respond_with(@entity) do |format| format.js { render 'subscription_update', entity: entity } end end |
#unsubscribe ⇒ Object
Common unsubscribe handler for all core controllers.
55 56 57 58 59 60 61 62 |
# File 'app/controllers/entities_controller.rb', line 55 def unsubscribe entity.subscribed_users -= [current_user.id] entity.save respond_with(entity) do |format| format.js { render 'subscription_update', entity: entity } end end |
#versions ⇒ Object
GET /entities/versions AJAX
81 82 |
# File 'app/controllers/entities_controller.rb', line 81 def versions end |