extjs-extjs-mvc 0.1.0 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.8
@@ -2,9 +2,6 @@ module ExtJS::Controller
2
2
 
3
3
  def self.included(controller)
4
4
  controller.send(:extend, ClassMethods)
5
- controller.class_eval do
6
- helper ExtJS::Data
7
- end
8
5
  end
9
6
 
10
7
  ##
@@ -55,4 +52,4 @@ module ExtJS::Controller
55
52
  end
56
53
 
57
54
  end
58
- end
55
+ end
@@ -1,4 +1,4 @@
1
- module ExtJS::Data
1
+ module ExtJS::Helpers
2
2
  module Store
3
3
  def extjs_store(params)
4
4
  params[:format] = 'json' if params[:format].nil?
@@ -32,8 +32,17 @@ module ExtJS::Data
32
32
  end
33
33
  script += "});"
34
34
  end
35
- "new Ext.data.#{type}Store(#{params[:config].to_json});#{script}"
35
+
36
+ if params[:config]["writer"] # <-- ugly hack because 3.0.1 can't deal with Writer as config-param
37
+ writer = params[:config].delete("writer")
38
+ json = params[:config].to_json
39
+ json[json.length-1] = ','
40
+ json += "writer:new Ext.data.#{params[:format].capitalize}Writer(#{writer.to_json})}"
41
+ "new Ext.data.#{type}Store(#{json});#{script}"
42
+ else
43
+ "new Ext.data.#{type}Store(#{params[:config].to_json});#{script}"
44
+ end
36
45
 
37
46
  end
38
47
  end
39
- end
48
+ end
@@ -50,7 +50,16 @@ module ExtJS
50
50
  {
51
51
  "fields" => @@fields.collect {|f|
52
52
  col = self.columns.find {|c| c.name.to_sym === f}
53
- field = {:name => col.name, :allowBlank => col.null, :type => col.type}
53
+ type = col.type
54
+ case col.type
55
+ when :datetime || :date || :time || :timestamp
56
+ type = :date
57
+ when :text
58
+ type = :string
59
+ when :integer
60
+ type = :int
61
+ end
62
+ field = {:name => col.name, :allowBlank => col.null, :type => type}
54
63
  field[:dateFormat] = "c" if col.type === :datetime || col.type === :date # <-- ugly hack for date
55
64
  field
56
65
  },
data/lib/extjs-mvc.rb CHANGED
@@ -11,7 +11,7 @@ module ExtJS
11
11
  require 'active_record/model'
12
12
  end
13
13
  require 'action_controller/controller'
14
- require 'action_view/helpers/data/store'
14
+ require 'action_view/helpers/store'
15
15
  end
16
16
  end
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extjs-extjs-mvc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.8
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-08-27 00:00:00 -07:00
12
+ date: 2009-08-28 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -39,7 +39,7 @@ files:
39
39
  - Rakefile
40
40
  - VERSION
41
41
  - lib/action_controller/controller.rb
42
- - lib/action_view/helpers/data/store.rb
42
+ - lib/action_view/helpers/store.rb
43
43
  - lib/active_record/model.rb
44
44
  - lib/dm/model.rb
45
45
  - lib/extjs-mvc.rb