Module: ExtJS::Controller::ClassMethods

Defined in:
lib/action_controller/controller.rb

Overview

Controller class methods

Instance Method Summary collapse

Instance Method Details

#extjs_message_property(value = nil) ⇒ Object



49
50
51
52
# File 'lib/action_controller/controller.rb', line 49

def extjs_message_property(value=nil)
  ExtJS::MVC.message_property = value unless value.nil?
  ExtJS::MVC.message_property
end

#extjs_proxy(params) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/action_controller/controller.rb', line 20

def extjs_proxy(params)
  proxy = {}
  if params[:proxy] === 'direct'
    actions = ['create', 'read', 'update', 'destroy']
    proxy["api"] = {}
    direct_actions.each_index do |n|
      proxy["api"][actions[n]] = direct_actions[n][:name]
    end
  else
    if params[:config]["api"]
      proxy["api"] = {}
      params[:config]["api"].each {|k,v| proxy["api"][k] = "/#{params[:controller]}/#{v}" }
    else
      proxy["url"] = "/#{params[:controller]}.#{params[:format].to_s}"
    end
  end
  proxy
end

#extjs_reader(model) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/action_controller/controller.rb', line 12

def extjs_reader(model)
  {
    "successProperty" => extjs_success_property,
    "root" => extjs_root,
    "messageProperty" => extjs_message_property
  }.merge(model.extjs_record)
end

#extjs_root(value = nil) ⇒ Object



39
40
41
42
# File 'lib/action_controller/controller.rb', line 39

def extjs_root(value=nil)
  ExtJS::MVC.root = value unless value.nil?
  ExtJS::MVC.root
end

#extjs_success_property(value = nil) ⇒ Object



44
45
46
47
# File 'lib/action_controller/controller.rb', line 44

def extjs_success_property(value=nil)
  ExtJS::MVC.success_property = value unless value.nil?
  ExtJS::MVC.success_property
end