extjs-mvc 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.15
1
+ 0.1.16
@@ -1,8 +1,17 @@
1
1
  module ExtJS::Helpers
2
2
  module Component
3
- def extjs_component(params)
4
- ExtJS::Component.new(self, params)
3
+ def extjs_component(*params)
4
+ ExtJS::Component.new(self, params.extract_options!)
5
5
  end
6
+
7
+ def extjs_onready(*params)
8
+ output = ''
9
+ params.each do |cmp|
10
+ output += (cmp.kind_of?(ExtJS::Component)) ? cmp.render : cmp
11
+ end
12
+ "<script>Ext.onReady(function() { #{output} });</script>"
13
+ end
14
+
6
15
  end
7
16
  end
8
17
 
@@ -26,9 +35,8 @@ class ExtJS::Component
26
35
  def add(*config)
27
36
  options = config.extract_options!
28
37
  if !options.keys.empty?
29
- if options[:partial]
38
+ if url = options.delete(:partial)
30
39
  # rendering a partial, cache the config until partial calls #add method. @see else.
31
- url = options.delete(:partial)
32
40
  @partial_config = options
33
41
  return @controller.render(:partial => url, :locals => {:container => self})
34
42
  else
@@ -37,14 +45,13 @@ class ExtJS::Component
37
45
  end
38
46
  elsif !config.empty? && config.first.kind_of?(ExtJS::Component)
39
47
  cmp = config.first
40
- cmp.apply(@partial_config) unless @partial_config.nil?
48
+ cmp.apply(@partial_config) unless @partial_config.nil?
41
49
  @config[:items] << cmp.config
42
50
  end
43
51
  @partial_config = nil
44
52
  end
45
53
 
46
54
  def render
47
- cmp = "Ext.ComponentMgr.create(#{@config.to_json});"
48
- "Ext.onReady(function() {#{cmp}});"
55
+ "Ext.ComponentMgr.create(#{@config.to_json});"
49
56
  end
50
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extjs-mvc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Scott
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-03 00:00:00 -07:00
12
+ date: 2009-09-04 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency