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.
23 24 25 26 27 28 29 |
# File 'app/controllers/entities_controller.rb', line 23 def attach @attachment = find_class(params[:assets]).find(params[:asset_id]) @attached = entity.attach!(@attachment) entity.reload respond_with(entity) end |
#contacts ⇒ Object
GET /entities/contacts AJAX
65 66 |
# File 'app/controllers/entities_controller.rb', line 65 def contacts end |
#discard ⇒ Object
Common discard handler for all core controllers.
33 34 35 36 37 38 39 |
# File 'app/controllers/entities_controller.rb', line 33 def discard @attachment = find_class(params[:attachment]).find(params[:attachment_id]) entity.discard!(@attachment) entity.reload respond_with(entity) end |
#field_group ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'app/controllers/entities_controller.rb', line 84 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
70 71 |
# File 'app/controllers/entities_controller.rb', line 70 def leads end |
#opportunities ⇒ Object
GET /entities/opportunities AJAX
75 76 |
# File 'app/controllers/entities_controller.rb', line 75 def opportunities end |
#subscribe ⇒ Object
Common subscribe handler for all core controllers.
43 44 45 46 47 48 49 50 |
# File 'app/controllers/entities_controller.rb', line 43 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.
54 55 56 57 58 59 60 61 |
# File 'app/controllers/entities_controller.rb', line 54 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
80 81 |
# File 'app/controllers/entities_controller.rb', line 80 def versions end |