Sha256: 763988cc492dad834371fd455cfefa56cc4b549400c312eb09ec6d0fd421f111

Contents?: true

Size: 1.28 KB

Versions: 33

Compression:

Stored size: 1.28 KB

Contents

module ErpApp
	module Organizer
		class BaseController < ErpApp::ApplicationController
		  layout nil
      before_filter :require_login
		  
		  def index
        @user = current_user
        @organizer = @user.organizer
		  end
		  
		  def get_preferences
        user = current_user
        organizer = ::Organizer.find_by_user(user)

        render :inline => "{\"success\":true, \"preferences\":#{organizer.preferences.to_json(:include => [:preference_type, :preference_option])}}"
		  end

		  def setup_preferences
		    user = current_user
        organizer = ::Organizer.find_by_user(user)
			
        render :inline => "{\"success\":true, \"preference_types\":#{organizer.preference_types.to_json(:include => :preference_options)}}"
		  end

		  def update_preferences
        user = current_user
        organizer = ::Organizer.find_by_user(user)

        params.each do |k,v|
          organizer.set_preference(k, v) unless (k.to_s == 'action' or k.to_s == 'controller' or k.to_s == 'authenticity_token')
        end
        organizer.save
			
        render :inline => "{\"success\":true, \"preferences\":#{organizer.preferences.to_json(:include => [:preference_type, :preference_option])}}"
		  end
      
		end#BaseController
	end#Organizer
end#ErpApp

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
erp_app-4.0.0 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.16 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.15 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.14 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.13 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.12 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.11 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.10 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.9 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.8 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.7 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.6 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.5 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.4 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.3 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.2 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.0.16 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.0.15 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.1 app/controllers/erp_app/organizer/base_controller.rb
erp_app-3.1.0 app/controllers/erp_app/organizer/base_controller.rb