Class: ErpApp::Desktop::ControlPanel::ApplicationManagementController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- BaseController
- ErpApp::Desktop::ControlPanel::ApplicationManagementController
- Defined in:
- app/controllers/erp_app/desktop/control_panel/application_management_controller.rb
Instance Method Summary collapse
- #all_users_applcations ⇒ Object
- #current_user_applcations ⇒ Object
- #preferences ⇒ Object
- #setup ⇒ Object
- #update ⇒ Object
Methods inherited from BaseController
Instance Method Details
#all_users_applcations ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/erp_app/desktop/control_panel/application_management_controller.rb', line 46 def all_users_applcations user_id = params[:id] user = User.find(user_id) entity_info = nil if user.party.business_party.is_a?(Individual) entity_info = user.party.business_party.to_json(:only => [:current_first_name, :current_last_name, :gender, :total_years_work_experience]) else entity_info = user.party.business_party.to_json(:only => [:description]) end render :inline => "{\"entityType\":\"#{user.party.business_party.class.to_s}\", \"entityInfo\":#{entity_info}}" end |
#current_user_applcations ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/erp_app/desktop/control_panel/application_management_controller.rb', line 6 def current_user_applcations user = current_user node_hashes = [] desktop = user.desktop desktop.applications.each do |application| node_hashes << {:text => application.description, :iconCls => application.icon, :leaf => true, :id => application.id} end render :json => node_hashes end |
#preferences ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/erp_app/desktop/control_panel/application_management_controller.rb', line 25 def preferences application_id = params[:id] user = current_user application = Application.find(application_id) render :inline => "{\"success\":true, \"preferences\":#{application.preferences(user).to_json(:include => [:preference_type, :preference_option])}}" end |
#setup ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/erp_app/desktop/control_panel/application_management_controller.rb', line 18 def setup application_id = params[:id] application = Application.find(application_id) render :inline => "{\"success\":true, \"preference_types\":#{application.preference_types.to_json(:methods => [:default_value], :include => :preference_options)}}" end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/erp_app/desktop/control_panel/application_management_controller.rb', line 33 def update application_id = params[:id] user = current_user application = Application.find(application_id) params.each do |k,v| application.set_user_preference(user, k, v) unless (k.to_s == 'action' or k.to_s == 'controller' or k.to_s == 'id' or k.to_s == 'authenticity_token') end application.save render :inline => "{\"success\":true, \"description\":'#{application.description}', \"shortcutId\":'#{application.shortcut_id}', \"shortcut\":'#{application.get_user_preference(user, :desktop_shortcut)}', \"preferences\":#{application.preferences(user).to_json(:include => [:preference_type, :preference_option])}}" end |