extjs-mvc 0.4.0.j → 0.4.0.k
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/extjs-mvc.rb +0 -14
- data/lib/extjs-mvc/api.rb +14 -27
- data/lib/extjs-mvc/src/App.js +219 -0
- data/lib/extjs-mvc/src/MVC.js +260 -0
- data/lib/extjs-mvc/src/Presenter.js +52 -0
- data/lib/extjs-mvc/src/README.rdoc +69 -0
- data/lib/extjs-mvc/src/controller/Controller.js +278 -0
- data/lib/extjs-mvc/src/controller/CrudController.js +460 -0
- data/lib/extjs-mvc/src/lib/Array.js +26 -0
- data/lib/extjs-mvc/src/lib/Booter.js +417 -0
- data/lib/extjs-mvc/src/lib/ClassManager.js +191 -0
- data/lib/extjs-mvc/src/lib/ControllerClassManager.js +95 -0
- data/lib/extjs-mvc/src/lib/Dependencies.js +44 -0
- data/lib/extjs-mvc/src/lib/DispatchMatcher.js +98 -0
- data/lib/extjs-mvc/src/lib/Dispatcher.js +129 -0
- data/lib/extjs-mvc/src/lib/Environment.js +43 -0
- data/lib/extjs-mvc/src/lib/Inflector.js +155 -0
- data/lib/extjs-mvc/src/lib/ModelClassManager.js +19 -0
- data/lib/extjs-mvc/src/lib/Route.js +139 -0
- data/lib/extjs-mvc/src/lib/Router.js +282 -0
- data/lib/extjs-mvc/src/lib/String.js +94 -0
- data/lib/extjs-mvc/src/lib/ViewClassManager.js +229 -0
- data/lib/extjs-mvc/src/lib/notes.txt +32 -0
- data/lib/extjs-mvc/src/model/AdapterManager.js +30 -0
- data/lib/extjs-mvc/src/model/Association.js +26 -0
- data/lib/extjs-mvc/src/model/Base.js +63 -0
- data/lib/extjs-mvc/src/model/BelongsToAssociation.js +116 -0
- data/lib/extjs-mvc/src/model/Cache.js +131 -0
- data/lib/extjs-mvc/src/model/HasManyAssociation.js +160 -0
- data/lib/extjs-mvc/src/model/Model.js +331 -0
- data/lib/extjs-mvc/src/model/UrlBuilder.js +106 -0
- data/lib/extjs-mvc/src/model/adapters/AbstractAdapter.js +296 -0
- data/lib/extjs-mvc/src/model/adapters/MemoryAdapter.js +103 -0
- data/lib/extjs-mvc/src/model/adapters/RESTAdapter.js +345 -0
- data/lib/extjs-mvc/src/model/adapters/RESTJSONAdapter.js +68 -0
- data/lib/extjs-mvc/src/model/adapters/notes.txt +42 -0
- data/lib/extjs-mvc/src/model/associations/Association.js +192 -0
- data/lib/extjs-mvc/src/model/associations/notes.txt +87 -0
- data/lib/extjs-mvc/src/model/validations/Errors.js +136 -0
- data/lib/extjs-mvc/src/model/validations/Plugin.js +139 -0
- data/lib/extjs-mvc/src/model/validations/Validations.js +276 -0
- data/lib/extjs-mvc/src/notes/Charts.graffle +0 -0
- data/lib/extjs-mvc/src/overrides/Ext.Component.js +21 -0
- data/lib/extjs-mvc/src/overrides/Ext.extend.js +142 -0
- data/lib/extjs-mvc/src/spec/Array.spec.js +15 -0
- data/lib/extjs-mvc/src/spec/ExtMVC.spec.js +65 -0
- data/lib/extjs-mvc/src/spec/Model.spec.js +370 -0
- data/lib/extjs-mvc/src/spec/OS.spec.js +83 -0
- data/lib/extjs-mvc/src/spec/Router.spec.js +99 -0
- data/lib/extjs-mvc/src/spec/SpecHelper.js +106 -0
- data/lib/extjs-mvc/src/spec/String.spec.js +83 -0
- data/lib/extjs-mvc/src/spec/model/AbstractAdapter.spec.js +49 -0
- data/lib/extjs-mvc/src/spec/model/Associations.spec.js +99 -0
- data/lib/extjs-mvc/src/spec/model/Cache.spec.js +5 -0
- data/lib/extjs-mvc/src/spec/model/RESTAdapter.spec.js +19 -0
- data/lib/extjs-mvc/src/spec/model/ValidationErrors.spec.js +64 -0
- data/lib/extjs-mvc/src/spec/model/Validations.spec.js +166 -0
- data/lib/extjs-mvc/src/spec/model/ValidationsPlugin.spec.js +108 -0
- data/lib/extjs-mvc/src/spec/suite.html +60 -0
- data/lib/extjs-mvc/src/specs-old/JSSpec.css +216 -0
- data/lib/extjs-mvc/src/specs-old/JSSpec.js +1512 -0
- data/lib/extjs-mvc/src/specs-old/all.html +66 -0
- data/lib/extjs-mvc/src/specs-old/base.js +14 -0
- data/lib/extjs-mvc/src/specs-old/controller.js +17 -0
- data/lib/extjs-mvc/src/specs-old/diff_match_patch.js +1 -0
- data/lib/extjs-mvc/src/specs-old/model.js +70 -0
- data/lib/extjs-mvc/src/specs-old/route.js +38 -0
- data/lib/extjs-mvc/src/specs-old/router.js +59 -0
- data/lib/extjs-mvc/src/specs-old/string.js +22 -0
- data/lib/extjs-mvc/src/testrunner/JSpecFormatter.js +111 -0
- data/lib/extjs-mvc/src/testrunner/TestClient.js +181 -0
- data/lib/extjs-mvc/src/testrunner/TestGrid.js +351 -0
- data/lib/extjs-mvc/src/testrunner/TestRunner.js +110 -0
- data/lib/extjs-mvc/src/testrunner/TestViewport.js +94 -0
- data/lib/extjs-mvc/src/vendor.yml +30 -0
- data/lib/extjs-mvc/src/vendor/ext-3.1.1/vendor.yml +16 -0
- data/lib/extjs-mvc/src/view/FormWindow.js +184 -0
- data/lib/extjs-mvc/src/view/HasManyEditorGridPanel.js +211 -0
- data/lib/extjs-mvc/src/view/scaffold/Edit.js +46 -0
- data/lib/extjs-mvc/src/view/scaffold/Index.js +561 -0
- data/lib/extjs-mvc/src/view/scaffold/New.js +20 -0
- data/lib/extjs-mvc/src/view/scaffold/ScaffoldFormPanel.js +255 -0
- data/lib/{vendor.yml → extjs-mvc/vendor.yml} +0 -0
- data/test/app/vendor/extjs-mvc/App.js +219 -0
- data/test/app/vendor/extjs-mvc/MVC.js +260 -0
- data/test/app/vendor/extjs-mvc/Presenter.js +52 -0
- data/test/app/vendor/extjs-mvc/README.rdoc +69 -0
- data/test/app/vendor/extjs-mvc/controller/Controller.js +278 -0
- data/test/app/vendor/extjs-mvc/controller/CrudController.js +460 -0
- data/test/app/vendor/extjs-mvc/lib/Array.js +26 -0
- data/test/app/vendor/extjs-mvc/lib/Booter.js +417 -0
- data/test/app/vendor/extjs-mvc/lib/ClassManager.js +191 -0
- data/test/app/vendor/extjs-mvc/lib/ControllerClassManager.js +95 -0
- data/test/app/vendor/extjs-mvc/lib/Dependencies.js +44 -0
- data/test/app/vendor/extjs-mvc/lib/DispatchMatcher.js +98 -0
- data/test/app/vendor/extjs-mvc/lib/Dispatcher.js +129 -0
- data/test/app/vendor/extjs-mvc/lib/Environment.js +43 -0
- data/test/app/vendor/extjs-mvc/lib/Inflector.js +155 -0
- data/test/app/vendor/extjs-mvc/lib/ModelClassManager.js +19 -0
- data/test/app/vendor/extjs-mvc/lib/Route.js +139 -0
- data/test/app/vendor/extjs-mvc/lib/Router.js +282 -0
- data/test/app/vendor/extjs-mvc/lib/String.js +94 -0
- data/test/app/vendor/extjs-mvc/lib/ViewClassManager.js +229 -0
- data/test/app/vendor/extjs-mvc/lib/notes.txt +32 -0
- data/test/app/vendor/extjs-mvc/model/AdapterManager.js +30 -0
- data/test/app/vendor/extjs-mvc/model/Association.js +26 -0
- data/test/app/vendor/extjs-mvc/model/Base.js +63 -0
- data/test/app/vendor/extjs-mvc/model/BelongsToAssociation.js +116 -0
- data/test/app/vendor/extjs-mvc/model/Cache.js +131 -0
- data/test/app/vendor/extjs-mvc/model/HasManyAssociation.js +160 -0
- data/test/app/vendor/extjs-mvc/model/Model.js +331 -0
- data/test/app/vendor/extjs-mvc/model/UrlBuilder.js +106 -0
- data/test/app/vendor/extjs-mvc/model/adapters/AbstractAdapter.js +296 -0
- data/test/app/vendor/extjs-mvc/model/adapters/MemoryAdapter.js +103 -0
- data/test/app/vendor/extjs-mvc/model/adapters/RESTAdapter.js +345 -0
- data/test/app/vendor/extjs-mvc/model/adapters/RESTJSONAdapter.js +68 -0
- data/test/app/vendor/extjs-mvc/model/adapters/notes.txt +42 -0
- data/test/app/vendor/extjs-mvc/model/associations/Association.js +192 -0
- data/test/app/vendor/extjs-mvc/model/associations/notes.txt +87 -0
- data/test/app/vendor/extjs-mvc/model/validations/Errors.js +136 -0
- data/test/app/vendor/extjs-mvc/model/validations/Plugin.js +139 -0
- data/test/app/vendor/extjs-mvc/model/validations/Validations.js +276 -0
- data/test/app/vendor/extjs-mvc/notes/Charts.graffle +0 -0
- data/test/app/vendor/extjs-mvc/overrides/Ext.Component.js +21 -0
- data/test/app/vendor/extjs-mvc/overrides/Ext.extend.js +142 -0
- data/test/app/vendor/extjs-mvc/spec/Array.spec.js +15 -0
- data/test/app/vendor/extjs-mvc/spec/ExtMVC.spec.js +65 -0
- data/test/app/vendor/extjs-mvc/spec/Model.spec.js +370 -0
- data/test/app/vendor/extjs-mvc/spec/OS.spec.js +83 -0
- data/test/app/vendor/extjs-mvc/spec/Router.spec.js +99 -0
- data/test/app/vendor/extjs-mvc/spec/SpecHelper.js +106 -0
- data/test/app/vendor/extjs-mvc/spec/String.spec.js +83 -0
- data/test/app/vendor/extjs-mvc/spec/model/AbstractAdapter.spec.js +49 -0
- data/test/app/vendor/extjs-mvc/spec/model/Associations.spec.js +99 -0
- data/test/app/vendor/extjs-mvc/spec/model/Cache.spec.js +5 -0
- data/test/app/vendor/extjs-mvc/spec/model/RESTAdapter.spec.js +19 -0
- data/test/app/vendor/extjs-mvc/spec/model/ValidationErrors.spec.js +64 -0
- data/test/app/vendor/extjs-mvc/spec/model/Validations.spec.js +166 -0
- data/test/app/vendor/extjs-mvc/spec/model/ValidationsPlugin.spec.js +108 -0
- data/test/app/vendor/extjs-mvc/spec/suite.html +60 -0
- data/test/app/vendor/extjs-mvc/specs-old/JSSpec.css +216 -0
- data/test/app/vendor/extjs-mvc/specs-old/JSSpec.js +1512 -0
- data/test/app/vendor/extjs-mvc/specs-old/all.html +66 -0
- data/test/app/vendor/extjs-mvc/specs-old/base.js +14 -0
- data/test/app/vendor/extjs-mvc/specs-old/controller.js +17 -0
- data/test/app/vendor/extjs-mvc/specs-old/diff_match_patch.js +1 -0
- data/test/app/vendor/extjs-mvc/specs-old/model.js +70 -0
- data/test/app/vendor/extjs-mvc/specs-old/route.js +38 -0
- data/test/app/vendor/extjs-mvc/specs-old/router.js +59 -0
- data/test/app/vendor/extjs-mvc/specs-old/string.js +22 -0
- data/test/app/vendor/extjs-mvc/testrunner/JSpecFormatter.js +111 -0
- data/test/app/vendor/extjs-mvc/testrunner/TestClient.js +181 -0
- data/test/app/vendor/extjs-mvc/testrunner/TestGrid.js +351 -0
- data/test/app/vendor/extjs-mvc/testrunner/TestRunner.js +110 -0
- data/test/app/vendor/extjs-mvc/testrunner/TestViewport.js +94 -0
- data/test/app/vendor/extjs-mvc/vendor.yml +30 -0
- data/test/app/vendor/extjs-mvc/vendor/ext-3.1.1/vendor.yml +16 -0
- data/test/app/vendor/extjs-mvc/view/FormWindow.js +184 -0
- data/test/app/vendor/extjs-mvc/view/HasManyEditorGridPanel.js +211 -0
- data/test/app/vendor/extjs-mvc/view/scaffold/Edit.js +46 -0
- data/test/app/vendor/extjs-mvc/view/scaffold/Index.js +561 -0
- data/test/app/vendor/extjs-mvc/view/scaffold/New.js +20 -0
- data/test/app/vendor/extjs-mvc/view/scaffold/ScaffoldFormPanel.js +255 -0
- data/test/helper.rb +7 -1
- data/test/test_extjs-mvc.rb +46 -0
- metadata +167 -7
- data/test/test_extjs-mvc-gem.rb +0 -7
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* @class ExtMVC.view.scaffold.New
|
3
|
+
* @extends ExtMVC.view.scaffold.ScaffoldFormPanel
|
4
|
+
* Shows a generic new form for a given model
|
5
|
+
*/
|
6
|
+
ExtMVC.registerView('scaffold', 'new', {
|
7
|
+
xtype : 'scaffold_form',
|
8
|
+
registerXType: 'scaffold_new',
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Sets this panel's title, if not already set. Also specifies the save handler to use
|
12
|
+
*/
|
13
|
+
initComponent: function() {
|
14
|
+
Ext.applyIf(this, {
|
15
|
+
title: 'New ' + this.model.prototype.singularHumanName
|
16
|
+
});
|
17
|
+
|
18
|
+
ExtMVC.getView('scaffold', 'form').prototype.initComponent.apply(this, arguments);
|
19
|
+
}
|
20
|
+
});
|
@@ -0,0 +1,255 @@
|
|
1
|
+
/**
|
2
|
+
* @class ExtMVC.view.scaffold.ScaffoldFormPanel
|
3
|
+
* @extends Ext.form.FormPanel
|
4
|
+
* Base class for any scaffold form panel (e.g. new and edit forms)
|
5
|
+
*/
|
6
|
+
ExtMVC.registerView('scaffold', 'form', {
|
7
|
+
xtype : 'form',
|
8
|
+
registerXType: 'scaffold_form',
|
9
|
+
|
10
|
+
autoScroll: true,
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Sets up the FormPanel, adds default configuration and items
|
14
|
+
*/
|
15
|
+
constructor: function(config) {
|
16
|
+
var config = config || {};
|
17
|
+
|
18
|
+
this.model = config.model;
|
19
|
+
|
20
|
+
if (this.model == undefined) {
|
21
|
+
throw new Ext.Error(String.format("No model supplied to scaffold Form {0}", config.title), config);
|
22
|
+
}
|
23
|
+
|
24
|
+
Ext.form.FormPanel.prototype.constructor.call(this, config);
|
25
|
+
},
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Adds default items, keys and buttons to the form
|
29
|
+
*/
|
30
|
+
initComponent: function() {
|
31
|
+
Ext.applyIf(this, {
|
32
|
+
items : this.buildItems(),
|
33
|
+
monitorPoll : 500,
|
34
|
+
keys : [
|
35
|
+
{
|
36
|
+
key: Ext.EventObject.ESC,
|
37
|
+
scope: this,
|
38
|
+
handler: this.onCancel
|
39
|
+
},
|
40
|
+
{
|
41
|
+
key: 's',
|
42
|
+
ctrl: true,
|
43
|
+
scope: this,
|
44
|
+
stopEvent: true,
|
45
|
+
handler: this.onSave
|
46
|
+
}
|
47
|
+
],
|
48
|
+
|
49
|
+
/**
|
50
|
+
* @property hasSaveButton
|
51
|
+
* @type Boolean
|
52
|
+
* True to include a save button (defaults to true)
|
53
|
+
*/
|
54
|
+
hasSaveButton: true,
|
55
|
+
|
56
|
+
/**
|
57
|
+
* @property hasCancelButton
|
58
|
+
* @type Boolean
|
59
|
+
* True to include a cancel button (defaults to true)
|
60
|
+
*/
|
61
|
+
hasCancelButton: true
|
62
|
+
});
|
63
|
+
|
64
|
+
//applyIf applies when buttons: [] is passed, which meant there was no way to
|
65
|
+
//specify any empty set of buttons before
|
66
|
+
if (!Ext.isArray(this.buttons)) {
|
67
|
+
Ext.apply(this, {
|
68
|
+
buttons: this.buildButtons()
|
69
|
+
});
|
70
|
+
}
|
71
|
+
|
72
|
+
Ext.form.FormPanel.prototype.initComponent.apply(this, arguments);
|
73
|
+
|
74
|
+
this.initEvents();
|
75
|
+
this.initListeners();
|
76
|
+
},
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Sets up any listeners on related objects. By default this just listens to update-failed and create-failed
|
80
|
+
* events on the related controller and marks fields as invalid as appropriate
|
81
|
+
*/
|
82
|
+
initListeners: function() {
|
83
|
+
if (this.controller) {
|
84
|
+
this.controller.on({
|
85
|
+
scope : this,
|
86
|
+
'create-failed': this.showErrorsFromInstance,
|
87
|
+
'update-failed': this.showErrorsFromInstance
|
88
|
+
});
|
89
|
+
}
|
90
|
+
},
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Reads errors from a model instance and marks the relevant fields as invalid
|
94
|
+
* @param {ExtMVC.Model.Base} instance The model instance
|
95
|
+
*/
|
96
|
+
showErrorsFromInstance: function(instance) {
|
97
|
+
this.getForm().markInvalid(instance.errors.forForm());
|
98
|
+
},
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Sets up events emitted by this component
|
102
|
+
*/
|
103
|
+
initEvents: function() {
|
104
|
+
this.addEvents(
|
105
|
+
/**
|
106
|
+
* @event save
|
107
|
+
* Fired when the user clicks the save button, or presses ctrl + s
|
108
|
+
* @param {Object} values The values entered into the form
|
109
|
+
* @param {ExtMVC.view.scaffold.ScaffoldFormPanel} this The form panel
|
110
|
+
*/
|
111
|
+
'save',
|
112
|
+
|
113
|
+
/**
|
114
|
+
* @event cancel
|
115
|
+
* Fired when the user clicks the cancel button, or presses the esc key
|
116
|
+
* @param {ExtMVC.Model.Base|Null} instance If editing an existing instance, this is a reference to that instance
|
117
|
+
*/
|
118
|
+
'cancel'
|
119
|
+
);
|
120
|
+
|
121
|
+
//taken from default Ext.FormPanel.initEvents - used to listen to the current validation of the form
|
122
|
+
//and fire off events
|
123
|
+
if (this.monitorValid) this.startMonitoring();
|
124
|
+
},
|
125
|
+
|
126
|
+
/**
|
127
|
+
* @property formItemConfig
|
128
|
+
* @type Object
|
129
|
+
* Default config which will be passed to all form items
|
130
|
+
*/
|
131
|
+
formItemConfig: {
|
132
|
+
anchor: '-40',
|
133
|
+
xtype: 'textfield'
|
134
|
+
},
|
135
|
+
|
136
|
+
/**
|
137
|
+
* @property ignoreFields
|
138
|
+
* @type Array
|
139
|
+
* An array of fields not to show in the form (defaults to empty)
|
140
|
+
*/
|
141
|
+
ignoreFields: ['id', 'created_at', 'updated_at'],
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Builds the buttons added to this form. By default this returns an array containing
|
145
|
+
* a Save button and a Cancel button, which fire the 'save' and 'cancel' events respectively
|
146
|
+
* @return {Array} An array of Ext.Button objects or configs
|
147
|
+
*/
|
148
|
+
buildButtons: function() {
|
149
|
+
var buttons = [];
|
150
|
+
|
151
|
+
if (this.hasSaveButton === true) buttons.push(this.buildSaveButton());
|
152
|
+
if (this.hasCancelButton === true) buttons.push(this.buildCancelButton());
|
153
|
+
|
154
|
+
return buttons;
|
155
|
+
},
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Builds the Save button config. Override this to provide your own
|
159
|
+
* @return {Object/Ext.Button} The button config or object
|
160
|
+
*/
|
161
|
+
buildSaveButton: function() {
|
162
|
+
return {
|
163
|
+
text: 'Save',
|
164
|
+
scope: this,
|
165
|
+
iconCls: 'save',
|
166
|
+
handler: this.onSave,
|
167
|
+
formBind: (this.monitorValid) ? true : false
|
168
|
+
};
|
169
|
+
},
|
170
|
+
|
171
|
+
/**
|
172
|
+
* Builds the Cancel button config. Override this to provide your own
|
173
|
+
* @return {Object/Ext.Button} The button config or object
|
174
|
+
*/
|
175
|
+
buildCancelButton: function() {
|
176
|
+
return {
|
177
|
+
text: 'Cancel',
|
178
|
+
scope: this,
|
179
|
+
iconCls: 'cancel',
|
180
|
+
handler: this.onCancel
|
181
|
+
};
|
182
|
+
},
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Builds an array of form items for the given model
|
186
|
+
* @param {ExtMVC.Model} model The model to build form items for
|
187
|
+
* @return {Array} An array of auto-generated form items
|
188
|
+
*/
|
189
|
+
buildItems: function() {
|
190
|
+
items = [];
|
191
|
+
|
192
|
+
//check to see if FormFields have been created for this model
|
193
|
+
//e.g. for a MyApp.models.User model, checks for existence of MyApp.views.users.FormFields
|
194
|
+
if (this.viewsPackage && this.viewsPackage.FormFields) {
|
195
|
+
items = this.viewsPackage.FormFields;
|
196
|
+
} else {
|
197
|
+
//no user defined form fields, generate them automatically
|
198
|
+
var model = this.model,
|
199
|
+
proto = model.prototype,
|
200
|
+
fields = proto.fields;
|
201
|
+
|
202
|
+
fields.each(function(field) {
|
203
|
+
|
204
|
+
//add if it's not a field to be ignored
|
205
|
+
if (this.ignoreFields.indexOf(field.name) == -1) {
|
206
|
+
items.push(Ext.applyIf({
|
207
|
+
name: field.name,
|
208
|
+
fieldLabel: (field.name.replace(/_/g, " ")).capitalize()
|
209
|
+
}));
|
210
|
+
}
|
211
|
+
}, this);
|
212
|
+
}
|
213
|
+
|
214
|
+
//apply defaults to each item
|
215
|
+
for (var i=0; i < items.length; i++) {
|
216
|
+
if (items[i].layout === undefined) Ext.applyIf(items[i], this.formItemConfig);
|
217
|
+
}
|
218
|
+
|
219
|
+
return items;
|
220
|
+
},
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Called when the save button is clicked or CTRL + s pressed. By default this simply fires
|
224
|
+
* the 'save' event, passing this.getForm().getValues() as the sole argument
|
225
|
+
*/
|
226
|
+
onSave: function() {
|
227
|
+
this.fireEvent('save', this.getFormValues(), this);
|
228
|
+
},
|
229
|
+
|
230
|
+
/**
|
231
|
+
* Gets form values in a nicer way than getForm.getValues() does - calls getValue on each field.
|
232
|
+
* See http://www.diloc.de/blog/2008/03/05/how-to-submit-ext-forms-the-right-way/
|
233
|
+
* @return {Object} key: value pairings of form values
|
234
|
+
*/
|
235
|
+
getFormValues: function() {
|
236
|
+
var form = this.getForm(),
|
237
|
+
values = {};
|
238
|
+
|
239
|
+
form.items.each(function(item) {
|
240
|
+
var func = (typeof item.getSubmitValue == "function") ? 'getSubmitValue' : 'getValue';
|
241
|
+
|
242
|
+
values[item.getName()] = item[func]();
|
243
|
+
}, this);
|
244
|
+
|
245
|
+
return values;
|
246
|
+
},
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Called when the cancel button is clicked or ESC pressed. Fires the 'cancel' event. If this is
|
250
|
+
* an edit form the cancel event will be called with a single argument - the current instance
|
251
|
+
*/
|
252
|
+
onCancel: function() {
|
253
|
+
this.fireEvent('cancel', this.instance, this);
|
254
|
+
}
|
255
|
+
});
|
data/test/helper.rb
CHANGED
@@ -4,7 +4,13 @@ require 'shoulda'
|
|
4
4
|
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
-
|
7
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
8
|
+
|
9
|
+
|
10
|
+
require 'xmvc'
|
11
|
+
require 'xmvc/cli'
|
12
|
+
require 'extjs-mvc'
|
8
13
|
|
9
14
|
class Test::Unit::TestCase
|
15
|
+
|
10
16
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestVendorInstaller < Test::Unit::TestCase
|
4
|
+
VENDOR_ROOT = "test/app/vendor"
|
5
|
+
|
6
|
+
context "ExtJS Vendor" do
|
7
|
+
should "install" do
|
8
|
+
path = "test/app/vendor/#{ExtJS::MVC::API.vendor_name}"
|
9
|
+
FileUtils.rm_rf(path) if File.exists? path
|
10
|
+
vendor = ExtJS::MVC::API.install({
|
11
|
+
:root => VENDOR_ROOT
|
12
|
+
})
|
13
|
+
assert File.exists?(File.join(VENDOR_ROOT, "#{ExtJS::MVC::API.vendor_name}/vendor.yml"))
|
14
|
+
end
|
15
|
+
|
16
|
+
should "load" do
|
17
|
+
vendor = ExtJS::MVC::API.load({
|
18
|
+
:root => VENDOR_ROOT
|
19
|
+
})
|
20
|
+
assert vendor.config.kind_of?(Hash) and vendor.config["name"] == ExtJS::MVC::API.vendor_name
|
21
|
+
end
|
22
|
+
|
23
|
+
should "return secretary" do
|
24
|
+
vendor = ExtJS::MVC::API.load({
|
25
|
+
:root => VENDOR_ROOT
|
26
|
+
})
|
27
|
+
secretary = vendor.invoke(:secretary)
|
28
|
+
assert secretary.instance_of?(Sprockets::Secretary)
|
29
|
+
end
|
30
|
+
|
31
|
+
should "secretary should contain files" do
|
32
|
+
vendor = ExtJS::MVC::API.load({
|
33
|
+
:root => "test/app/vendor"
|
34
|
+
})
|
35
|
+
secretary = vendor.invoke(:secretary)
|
36
|
+
assert secretary.preprocessor.source_files.length > 0
|
37
|
+
end
|
38
|
+
|
39
|
+
should "Have host default to 'public' when not defined in vendor.yml" do
|
40
|
+
vendor = ExtJS::MVC::API.load({
|
41
|
+
:root => "test/app/vendor"
|
42
|
+
})
|
43
|
+
assert vendor.config['host'] == "public"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 4
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.4.0.
|
9
|
+
- k
|
10
|
+
version: 0.4.0.k
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ed Spencer and Chris Scott
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-03-
|
18
|
+
date: 2010-03-19 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
type: :runtime
|
74
74
|
version_requirements: *id004
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: shoulda
|
77
77
|
prerelease: false
|
78
78
|
requirement: &id005 !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
@@ -103,9 +103,169 @@ files:
|
|
103
103
|
- bin/run
|
104
104
|
- lib/extjs-mvc.rb
|
105
105
|
- lib/extjs-mvc/api.rb
|
106
|
-
- lib/
|
106
|
+
- lib/extjs-mvc/src/App.js
|
107
|
+
- lib/extjs-mvc/src/MVC.js
|
108
|
+
- lib/extjs-mvc/src/Presenter.js
|
109
|
+
- lib/extjs-mvc/src/README.rdoc
|
110
|
+
- lib/extjs-mvc/src/controller/Controller.js
|
111
|
+
- lib/extjs-mvc/src/controller/CrudController.js
|
112
|
+
- lib/extjs-mvc/src/lib/Array.js
|
113
|
+
- lib/extjs-mvc/src/lib/Booter.js
|
114
|
+
- lib/extjs-mvc/src/lib/ClassManager.js
|
115
|
+
- lib/extjs-mvc/src/lib/ControllerClassManager.js
|
116
|
+
- lib/extjs-mvc/src/lib/Dependencies.js
|
117
|
+
- lib/extjs-mvc/src/lib/DispatchMatcher.js
|
118
|
+
- lib/extjs-mvc/src/lib/Dispatcher.js
|
119
|
+
- lib/extjs-mvc/src/lib/Environment.js
|
120
|
+
- lib/extjs-mvc/src/lib/Inflector.js
|
121
|
+
- lib/extjs-mvc/src/lib/ModelClassManager.js
|
122
|
+
- lib/extjs-mvc/src/lib/Route.js
|
123
|
+
- lib/extjs-mvc/src/lib/Router.js
|
124
|
+
- lib/extjs-mvc/src/lib/String.js
|
125
|
+
- lib/extjs-mvc/src/lib/ViewClassManager.js
|
126
|
+
- lib/extjs-mvc/src/lib/notes.txt
|
127
|
+
- lib/extjs-mvc/src/model/AdapterManager.js
|
128
|
+
- lib/extjs-mvc/src/model/Association.js
|
129
|
+
- lib/extjs-mvc/src/model/Base.js
|
130
|
+
- lib/extjs-mvc/src/model/BelongsToAssociation.js
|
131
|
+
- lib/extjs-mvc/src/model/Cache.js
|
132
|
+
- lib/extjs-mvc/src/model/HasManyAssociation.js
|
133
|
+
- lib/extjs-mvc/src/model/Model.js
|
134
|
+
- lib/extjs-mvc/src/model/UrlBuilder.js
|
135
|
+
- lib/extjs-mvc/src/model/adapters/AbstractAdapter.js
|
136
|
+
- lib/extjs-mvc/src/model/adapters/MemoryAdapter.js
|
137
|
+
- lib/extjs-mvc/src/model/adapters/RESTAdapter.js
|
138
|
+
- lib/extjs-mvc/src/model/adapters/RESTJSONAdapter.js
|
139
|
+
- lib/extjs-mvc/src/model/adapters/notes.txt
|
140
|
+
- lib/extjs-mvc/src/model/associations/Association.js
|
141
|
+
- lib/extjs-mvc/src/model/associations/notes.txt
|
142
|
+
- lib/extjs-mvc/src/model/validations/Errors.js
|
143
|
+
- lib/extjs-mvc/src/model/validations/Plugin.js
|
144
|
+
- lib/extjs-mvc/src/model/validations/Validations.js
|
145
|
+
- lib/extjs-mvc/src/notes/Charts.graffle
|
146
|
+
- lib/extjs-mvc/src/overrides/Ext.Component.js
|
147
|
+
- lib/extjs-mvc/src/overrides/Ext.extend.js
|
148
|
+
- lib/extjs-mvc/src/spec/Array.spec.js
|
149
|
+
- lib/extjs-mvc/src/spec/ExtMVC.spec.js
|
150
|
+
- lib/extjs-mvc/src/spec/Model.spec.js
|
151
|
+
- lib/extjs-mvc/src/spec/OS.spec.js
|
152
|
+
- lib/extjs-mvc/src/spec/Router.spec.js
|
153
|
+
- lib/extjs-mvc/src/spec/SpecHelper.js
|
154
|
+
- lib/extjs-mvc/src/spec/String.spec.js
|
155
|
+
- lib/extjs-mvc/src/spec/model/AbstractAdapter.spec.js
|
156
|
+
- lib/extjs-mvc/src/spec/model/Associations.spec.js
|
157
|
+
- lib/extjs-mvc/src/spec/model/Cache.spec.js
|
158
|
+
- lib/extjs-mvc/src/spec/model/RESTAdapter.spec.js
|
159
|
+
- lib/extjs-mvc/src/spec/model/ValidationErrors.spec.js
|
160
|
+
- lib/extjs-mvc/src/spec/model/Validations.spec.js
|
161
|
+
- lib/extjs-mvc/src/spec/model/ValidationsPlugin.spec.js
|
162
|
+
- lib/extjs-mvc/src/spec/suite.html
|
163
|
+
- lib/extjs-mvc/src/specs-old/JSSpec.css
|
164
|
+
- lib/extjs-mvc/src/specs-old/JSSpec.js
|
165
|
+
- lib/extjs-mvc/src/specs-old/all.html
|
166
|
+
- lib/extjs-mvc/src/specs-old/base.js
|
167
|
+
- lib/extjs-mvc/src/specs-old/controller.js
|
168
|
+
- lib/extjs-mvc/src/specs-old/diff_match_patch.js
|
169
|
+
- lib/extjs-mvc/src/specs-old/model.js
|
170
|
+
- lib/extjs-mvc/src/specs-old/route.js
|
171
|
+
- lib/extjs-mvc/src/specs-old/router.js
|
172
|
+
- lib/extjs-mvc/src/specs-old/string.js
|
173
|
+
- lib/extjs-mvc/src/testrunner/JSpecFormatter.js
|
174
|
+
- lib/extjs-mvc/src/testrunner/TestClient.js
|
175
|
+
- lib/extjs-mvc/src/testrunner/TestGrid.js
|
176
|
+
- lib/extjs-mvc/src/testrunner/TestRunner.js
|
177
|
+
- lib/extjs-mvc/src/testrunner/TestViewport.js
|
178
|
+
- lib/extjs-mvc/src/vendor.yml
|
179
|
+
- lib/extjs-mvc/src/vendor/ext-3.1.1/vendor.yml
|
180
|
+
- lib/extjs-mvc/src/view/FormWindow.js
|
181
|
+
- lib/extjs-mvc/src/view/HasManyEditorGridPanel.js
|
182
|
+
- lib/extjs-mvc/src/view/scaffold/Edit.js
|
183
|
+
- lib/extjs-mvc/src/view/scaffold/Index.js
|
184
|
+
- lib/extjs-mvc/src/view/scaffold/New.js
|
185
|
+
- lib/extjs-mvc/src/view/scaffold/ScaffoldFormPanel.js
|
186
|
+
- lib/extjs-mvc/vendor.yml
|
187
|
+
- test/app/vendor/extjs-mvc/App.js
|
188
|
+
- test/app/vendor/extjs-mvc/MVC.js
|
189
|
+
- test/app/vendor/extjs-mvc/Presenter.js
|
190
|
+
- test/app/vendor/extjs-mvc/README.rdoc
|
191
|
+
- test/app/vendor/extjs-mvc/controller/Controller.js
|
192
|
+
- test/app/vendor/extjs-mvc/controller/CrudController.js
|
193
|
+
- test/app/vendor/extjs-mvc/lib/Array.js
|
194
|
+
- test/app/vendor/extjs-mvc/lib/Booter.js
|
195
|
+
- test/app/vendor/extjs-mvc/lib/ClassManager.js
|
196
|
+
- test/app/vendor/extjs-mvc/lib/ControllerClassManager.js
|
197
|
+
- test/app/vendor/extjs-mvc/lib/Dependencies.js
|
198
|
+
- test/app/vendor/extjs-mvc/lib/DispatchMatcher.js
|
199
|
+
- test/app/vendor/extjs-mvc/lib/Dispatcher.js
|
200
|
+
- test/app/vendor/extjs-mvc/lib/Environment.js
|
201
|
+
- test/app/vendor/extjs-mvc/lib/Inflector.js
|
202
|
+
- test/app/vendor/extjs-mvc/lib/ModelClassManager.js
|
203
|
+
- test/app/vendor/extjs-mvc/lib/Route.js
|
204
|
+
- test/app/vendor/extjs-mvc/lib/Router.js
|
205
|
+
- test/app/vendor/extjs-mvc/lib/String.js
|
206
|
+
- test/app/vendor/extjs-mvc/lib/ViewClassManager.js
|
207
|
+
- test/app/vendor/extjs-mvc/lib/notes.txt
|
208
|
+
- test/app/vendor/extjs-mvc/model/AdapterManager.js
|
209
|
+
- test/app/vendor/extjs-mvc/model/Association.js
|
210
|
+
- test/app/vendor/extjs-mvc/model/Base.js
|
211
|
+
- test/app/vendor/extjs-mvc/model/BelongsToAssociation.js
|
212
|
+
- test/app/vendor/extjs-mvc/model/Cache.js
|
213
|
+
- test/app/vendor/extjs-mvc/model/HasManyAssociation.js
|
214
|
+
- test/app/vendor/extjs-mvc/model/Model.js
|
215
|
+
- test/app/vendor/extjs-mvc/model/UrlBuilder.js
|
216
|
+
- test/app/vendor/extjs-mvc/model/adapters/AbstractAdapter.js
|
217
|
+
- test/app/vendor/extjs-mvc/model/adapters/MemoryAdapter.js
|
218
|
+
- test/app/vendor/extjs-mvc/model/adapters/RESTAdapter.js
|
219
|
+
- test/app/vendor/extjs-mvc/model/adapters/RESTJSONAdapter.js
|
220
|
+
- test/app/vendor/extjs-mvc/model/adapters/notes.txt
|
221
|
+
- test/app/vendor/extjs-mvc/model/associations/Association.js
|
222
|
+
- test/app/vendor/extjs-mvc/model/associations/notes.txt
|
223
|
+
- test/app/vendor/extjs-mvc/model/validations/Errors.js
|
224
|
+
- test/app/vendor/extjs-mvc/model/validations/Plugin.js
|
225
|
+
- test/app/vendor/extjs-mvc/model/validations/Validations.js
|
226
|
+
- test/app/vendor/extjs-mvc/notes/Charts.graffle
|
227
|
+
- test/app/vendor/extjs-mvc/overrides/Ext.Component.js
|
228
|
+
- test/app/vendor/extjs-mvc/overrides/Ext.extend.js
|
229
|
+
- test/app/vendor/extjs-mvc/spec/Array.spec.js
|
230
|
+
- test/app/vendor/extjs-mvc/spec/ExtMVC.spec.js
|
231
|
+
- test/app/vendor/extjs-mvc/spec/Model.spec.js
|
232
|
+
- test/app/vendor/extjs-mvc/spec/OS.spec.js
|
233
|
+
- test/app/vendor/extjs-mvc/spec/Router.spec.js
|
234
|
+
- test/app/vendor/extjs-mvc/spec/SpecHelper.js
|
235
|
+
- test/app/vendor/extjs-mvc/spec/String.spec.js
|
236
|
+
- test/app/vendor/extjs-mvc/spec/model/AbstractAdapter.spec.js
|
237
|
+
- test/app/vendor/extjs-mvc/spec/model/Associations.spec.js
|
238
|
+
- test/app/vendor/extjs-mvc/spec/model/Cache.spec.js
|
239
|
+
- test/app/vendor/extjs-mvc/spec/model/RESTAdapter.spec.js
|
240
|
+
- test/app/vendor/extjs-mvc/spec/model/ValidationErrors.spec.js
|
241
|
+
- test/app/vendor/extjs-mvc/spec/model/Validations.spec.js
|
242
|
+
- test/app/vendor/extjs-mvc/spec/model/ValidationsPlugin.spec.js
|
243
|
+
- test/app/vendor/extjs-mvc/spec/suite.html
|
244
|
+
- test/app/vendor/extjs-mvc/specs-old/JSSpec.css
|
245
|
+
- test/app/vendor/extjs-mvc/specs-old/JSSpec.js
|
246
|
+
- test/app/vendor/extjs-mvc/specs-old/all.html
|
247
|
+
- test/app/vendor/extjs-mvc/specs-old/base.js
|
248
|
+
- test/app/vendor/extjs-mvc/specs-old/controller.js
|
249
|
+
- test/app/vendor/extjs-mvc/specs-old/diff_match_patch.js
|
250
|
+
- test/app/vendor/extjs-mvc/specs-old/model.js
|
251
|
+
- test/app/vendor/extjs-mvc/specs-old/route.js
|
252
|
+
- test/app/vendor/extjs-mvc/specs-old/router.js
|
253
|
+
- test/app/vendor/extjs-mvc/specs-old/string.js
|
254
|
+
- test/app/vendor/extjs-mvc/testrunner/JSpecFormatter.js
|
255
|
+
- test/app/vendor/extjs-mvc/testrunner/TestClient.js
|
256
|
+
- test/app/vendor/extjs-mvc/testrunner/TestGrid.js
|
257
|
+
- test/app/vendor/extjs-mvc/testrunner/TestRunner.js
|
258
|
+
- test/app/vendor/extjs-mvc/testrunner/TestViewport.js
|
259
|
+
- test/app/vendor/extjs-mvc/vendor.yml
|
260
|
+
- test/app/vendor/extjs-mvc/vendor/ext-3.1.1/vendor.yml
|
261
|
+
- test/app/vendor/extjs-mvc/view/FormWindow.js
|
262
|
+
- test/app/vendor/extjs-mvc/view/HasManyEditorGridPanel.js
|
263
|
+
- test/app/vendor/extjs-mvc/view/scaffold/Edit.js
|
264
|
+
- test/app/vendor/extjs-mvc/view/scaffold/Index.js
|
265
|
+
- test/app/vendor/extjs-mvc/view/scaffold/New.js
|
266
|
+
- test/app/vendor/extjs-mvc/view/scaffold/ScaffoldFormPanel.js
|
107
267
|
- test/helper.rb
|
108
|
-
- test/test_extjs-mvc
|
268
|
+
- test/test_extjs-mvc.rb
|
109
269
|
has_rdoc: true
|
110
270
|
homepage: http://github.com/christocracy/extjs-mvc
|
111
271
|
licenses: []
|
@@ -140,4 +300,4 @@ specification_version: 3
|
|
140
300
|
summary: A Rails-like, full-stack MVC framework for the Ext JS javascript framework
|
141
301
|
test_files:
|
142
302
|
- test/helper.rb
|
143
|
-
- test/test_extjs-mvc
|
303
|
+
- test/test_extjs-mvc.rb
|