Class: EntitiesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/entities_controller.rb

Overview

Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.


Instance Method Summary collapse

Methods inherited from ApplicationController

#auto_complete

Instance Method Details

#attachObject

Common attach handler for all core controllers.




30
31
32
33
34
35
36
# File 'app/controllers/entities_controller.rb', line 30

def attach
  @attachment = params[:assets].classify.constantize.find(params[:asset_id])
  @attached = entity.attach!(@attachment)
  entity.reload

  respond_with(entity)
end

#contactsObject

GET /entities/contacts AJAX




72
73
# File 'app/controllers/entities_controller.rb', line 72

def contacts
end

#discardObject

Common discard handler for all core controllers.




40
41
42
43
44
45
46
# File 'app/controllers/entities_controller.rb', line 40

def discard
  @attachment = params[:attachment].constantize.find(params[:attachment_id])
  entity.discard!(@attachment)
  entity.reload

  respond_with(entity)
end

#leadsObject

GET /entities/leads AJAX




77
78
# File 'app/controllers/entities_controller.rb', line 77

def leads
end

#opportunitiesObject

GET /entities/opportunities AJAX




82
83
# File 'app/controllers/entities_controller.rb', line 82

def opportunities
end

#subscribeObject

Common subscribe handler for all core controllers.




50
51
52
53
54
55
56
57
# File 'app/controllers/entities_controller.rb', line 50

def subscribe
  entity.subscribed_users += [current_user.id]
  entity.save

  respond_with(entity) do |format|
    format.js { render 'subscription_update' }
  end
end

#unsubscribeObject

Common unsubscribe handler for all core controllers.




61
62
63
64
65
66
67
68
# File 'app/controllers/entities_controller.rb', line 61

def unsubscribe
  entity.subscribed_users -= [current_user.id]
  entity.save

  respond_with(entity) do |format|
    format.js { render 'subscription_update' }
  end
end

#versionsObject

GET /entities/versions AJAX




87
88
# File 'app/controllers/entities_controller.rb', line 87

def versions
end