cirandas.net

ref: master

plugins/cms_learning/controllers/cms_learning_plugin_myprofile_controller.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class CmsLearningPluginMyprofileController < MyProfileController

  protect 'edit_profile', :profile

  def product_categories
    @categories = ProductCategory.all :limit => 20, :conditions => ["name ~* ?", params[:q]]
    respond_to do |format|
      format.html
      format.json { render :json => @categories.collect{ |i| {:id => i.id, :name => i.name } } }
    end
  end

  def persons
    @persons = Person.all :limit => 20, :conditions => ["name ~* ?", params[:q]]
    respond_to do |format|
      format.html
      format.json { render :json => @persons.collect{ |i| {:id => i.id, :name => i.name } } }
    end
  end
end