Sha256: 5a0a765e1c7bb0f6cf495305f45b4e357acc7ac366ab3c44ed1f7cb9a7f28005
Contents?: true
Size: 1.92 KB
Versions: 15
Compression:
Stored size: 1.92 KB
Contents
module ErpApp module Desktop module UserManagement class ApplicationManagementController < ErpApp::Desktop::UserManagement::BaseController def available_applications user_id = params[:user_id] app_container_type = params[:app_container_type] user = User.find(user_id) app_container = "::#{app_container_type}".constantize.find_by_user(user) applications = "#{app_container_type}Application".constantize.all current_applications = app_container.applications applications.delete_if{|r| current_applications.collect(&:id).include?(r.id)} render :json => applications.map{|application| {:text => application.description, :app_id => application.id, :iconCls => application.icon, :leaf => true}} end def current_applications user_id = params[:user_id] app_container_type = params[:app_container_type] user = User.find(user_id) app_container = "::#{app_container_type}".constantize.find_by_user(user) render :json => app_container.applications.map{|application| {:text => application.description, :app_id => application.id, :iconCls => application.icon, :leaf => true}} end def save_applications app_ids = params[:app_ids] user_id = params[:user_id] app_container_type = params[:app_container_type] user = User.find(user_id) app_container = "::#{app_container_type}".constantize.find_by_user(user) app_container.applications = [] app_container.save app_ids.each do |app_id| app_container.applications << Application.find(app_id) end app_container.save render :json => {:success => true, :message => 'Application(s) Saved'} end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems