extjs-mvc 0.1.23 → 0.1.24

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.
Files changed (3) hide show
  1. data/README.rdoc +96 -2
  2. data/VERSION +1 -1
  3. metadata +2 -2
data/README.rdoc CHANGED
@@ -1,9 +1,103 @@
1
1
  = mvc
2
2
 
3
- Description goes here.
3
+ A collection of helpers, MVC mixins and PORs (plain-old-ruby-object) to assist with auto-generating ExtJS javascript component definitions.
4
+
5
+
6
+ ===Installation
7
+
8
+ % gem sources -a http://gems.github.com (you only have to do this once)
9
+ % sudo gem install extjs-mvc
10
+
11
+ In <tt>environment.rb</tt>
12
+
13
+ Rails::Initializer.run do |config|
14
+ .
15
+ .
16
+ .
17
+ end
18
+ require 'extjs-mvc'
19
+
20
+
21
+ === An ActiveRecord mixin: ExtJS::Model
22
+
23
+ include it in your model. Use the class-method <tt>extjs_fields</tt> to specify those
24
+ fields with will be used to render the <tt>Ext.data.Record.create</tt> field-def'n.
25
+ class User < ActiveRecord::Base
26
+ include ExtJS::Model
27
+
28
+ extjs_fields :exclude => [:password, :password_confirmation]
29
+ end
30
+
31
+ In script/console
32
+ >> User.extjs_fields
33
+ >> User.extjs_record
34
+ => { "idProperty"=>"id", "fields"=>[
35
+ {:type=>:int, :allowBlank=>true, :name=>"id"},
36
+ {:type=>:string, :allowBlank=>false, :name=>"first"},
37
+ {:type=>:string, :allowBlank=>false, :name=>"last"},
38
+ {:type=>:string, :allowBlank=>false, :name=>"email"}
39
+ ]}
40
+
41
+ === An ActionController mixin: ExtJS::Controller
42
+
43
+ <b>usage:</b>
44
+
45
+ class UsersController < ActionController::Base
46
+ include ExtJS::Controller
47
+ end
48
+
49
+ === View Helper: ExtJS::Helpers::Component
50
+
51
+ <b>usage:</b>
52
+
53
+ class UserController < ActionController::Base
54
+ include ExtJS::Controller
55
+ helper ExtJS::Helpers::Component
56
+ end
57
+
58
+ Now render Ext components using helper method <tt>extjs_component</tt>
59
+
60
+ @viewport = extjs_component(
61
+ "xtype" =&gt; "viewport",
62
+ "frame" =&gt; true,
63
+ "layout" =&gt; "border")
64
+ @viewport.add("xtype" =&gt; "panel", "contentEl" =&gt; "hd", "region" =&gt; "north", "height" =&gt; 30)
65
+ @viewport.add(:partial =&gt; "/users/grid", "itemId" =&gt; "users-grid", "region" =&gt; "west")
66
+ @viewport.add(:partial =&gt; "/tasks/grid", "itemId" =&gt; "tasks-grid", "region" =&gt; "center")
67
+ @viewport.add("xtype" =&gt; "panel", "contentEl" =&gt; "ft", "region" =&gt; "south", "height" =&gt; 20)
68
+
69
+ Note how it can also render partials. Partials will be invoked with a local-variable named "container", a reference to the
70
+ parent Ext::Component instance which added the partial. If no "container" is specified, it would be expected that your partial
71
+ would provide its own "renderTo" or "contentEl" property, just as in Ext.Component from ExtJS javascript library.
72
+
73
+
74
+ === View Helper: ExtJS::Helpers::Store
75
+
76
+ Renders an Ext.data.Store with helper method <tt>extjs_store</tt>
77
+
78
+ class UserController < ActionController::Base
79
+ include ExtJS::Controller
80
+ helper ExtJS::Helpers::Store
81
+ end
82
+
83
+
84
+ @store = extjs_store(
85
+ :controller => "users",
86
+ :proxy => "http" # <-- default
87
+ :format => "json" # <-- default
88
+ :model => "user", # <-- default: controller_name.singularize.camelize.constantize
89
+ :writer => {:encode => false},
90
+ :config => { # <-- standard Ext.data.Store config-params
91
+ "autoLoad" => true
92
+ "autoSave" => true
93
+ }
94
+ )
95
+
96
+ %= @store.render %
97
+
4
98
 
5
99
  == Note on Patches/Pull Requests
6
-
100
+
7
101
  * Fork the project.
8
102
  * Make your feature addition or bug fix.
9
103
  * Add tests for it. This is important so I don't break it in a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.23
1
+ 0.1.24
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.23
4
+ version: 0.1.24
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-07 00:00:00 -07:00
12
+ date: 2009-09-08 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency