extjs-mvc 0.4.0.f → 0.4.0.g

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 (86) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION +1 -1
  3. data/bin/extjs-mvc +0 -3
  4. data/lib/extjs-mvc.rb +10 -6
  5. data/lib/extjs-mvc/api.rb +0 -1
  6. metadata +8 -84
  7. data/lib/src/App.js +0 -219
  8. data/lib/src/MVC.js +0 -260
  9. data/lib/src/Presenter.js +0 -52
  10. data/lib/src/README.rdoc +0 -69
  11. data/lib/src/controller/Controller.js +0 -278
  12. data/lib/src/controller/CrudController.js +0 -460
  13. data/lib/src/lib/Array.js +0 -26
  14. data/lib/src/lib/Booter.js +0 -416
  15. data/lib/src/lib/ClassManager.js +0 -191
  16. data/lib/src/lib/ControllerClassManager.js +0 -95
  17. data/lib/src/lib/Dependencies.js +0 -44
  18. data/lib/src/lib/DispatchMatcher.js +0 -98
  19. data/lib/src/lib/Dispatcher.js +0 -129
  20. data/lib/src/lib/Environment.js +0 -43
  21. data/lib/src/lib/Inflector.js +0 -155
  22. data/lib/src/lib/ModelClassManager.js +0 -19
  23. data/lib/src/lib/Route.js +0 -139
  24. data/lib/src/lib/Router.js +0 -282
  25. data/lib/src/lib/String.js +0 -94
  26. data/lib/src/lib/ViewClassManager.js +0 -229
  27. data/lib/src/lib/notes.txt +0 -32
  28. data/lib/src/model/AdapterManager.js +0 -30
  29. data/lib/src/model/Association.js +0 -26
  30. data/lib/src/model/Base.js +0 -63
  31. data/lib/src/model/BelongsToAssociation.js +0 -116
  32. data/lib/src/model/Cache.js +0 -131
  33. data/lib/src/model/HasManyAssociation.js +0 -160
  34. data/lib/src/model/Model.js +0 -331
  35. data/lib/src/model/UrlBuilder.js +0 -106
  36. data/lib/src/model/adapters/AbstractAdapter.js +0 -296
  37. data/lib/src/model/adapters/MemoryAdapter.js +0 -103
  38. data/lib/src/model/adapters/RESTAdapter.js +0 -345
  39. data/lib/src/model/adapters/RESTJSONAdapter.js +0 -68
  40. data/lib/src/model/adapters/notes.txt +0 -42
  41. data/lib/src/model/associations/Association.js +0 -192
  42. data/lib/src/model/associations/notes.txt +0 -87
  43. data/lib/src/model/validations/Errors.js +0 -136
  44. data/lib/src/model/validations/Plugin.js +0 -139
  45. data/lib/src/model/validations/Validations.js +0 -276
  46. data/lib/src/notes/Charts.graffle +0 -0
  47. data/lib/src/overrides/Ext.Component.js +0 -21
  48. data/lib/src/overrides/Ext.extend.js +0 -142
  49. data/lib/src/spec/Array.spec.js +0 -15
  50. data/lib/src/spec/ExtMVC.spec.js +0 -65
  51. data/lib/src/spec/Model.spec.js +0 -370
  52. data/lib/src/spec/OS.spec.js +0 -83
  53. data/lib/src/spec/Router.spec.js +0 -99
  54. data/lib/src/spec/SpecHelper.js +0 -106
  55. data/lib/src/spec/String.spec.js +0 -83
  56. data/lib/src/spec/model/AbstractAdapter.spec.js +0 -49
  57. data/lib/src/spec/model/Associations.spec.js +0 -99
  58. data/lib/src/spec/model/Cache.spec.js +0 -5
  59. data/lib/src/spec/model/RESTAdapter.spec.js +0 -19
  60. data/lib/src/spec/model/ValidationErrors.spec.js +0 -64
  61. data/lib/src/spec/model/Validations.spec.js +0 -166
  62. data/lib/src/spec/model/ValidationsPlugin.spec.js +0 -108
  63. data/lib/src/spec/suite.html +0 -60
  64. data/lib/src/specs-old/JSSpec.css +0 -216
  65. data/lib/src/specs-old/JSSpec.js +0 -1512
  66. data/lib/src/specs-old/all.html +0 -66
  67. data/lib/src/specs-old/base.js +0 -14
  68. data/lib/src/specs-old/controller.js +0 -17
  69. data/lib/src/specs-old/diff_match_patch.js +0 -1
  70. data/lib/src/specs-old/model.js +0 -70
  71. data/lib/src/specs-old/route.js +0 -38
  72. data/lib/src/specs-old/router.js +0 -59
  73. data/lib/src/specs-old/string.js +0 -22
  74. data/lib/src/testrunner/JSpecFormatter.js +0 -111
  75. data/lib/src/testrunner/TestClient.js +0 -181
  76. data/lib/src/testrunner/TestGrid.js +0 -351
  77. data/lib/src/testrunner/TestRunner.js +0 -110
  78. data/lib/src/testrunner/TestViewport.js +0 -94
  79. data/lib/src/vendor.yml +0 -29
  80. data/lib/src/vendor/ext-3.1.1/vendor.yml +0 -16
  81. data/lib/src/view/FormWindow.js +0 -184
  82. data/lib/src/view/HasManyEditorGridPanel.js +0 -211
  83. data/lib/src/view/scaffold/Edit.js +0 -46
  84. data/lib/src/view/scaffold/Index.js +0 -561
  85. data/lib/src/view/scaffold/New.js +0 -20
  86. data/lib/src/view/scaffold/ScaffoldFormPanel.js +0 -255
@@ -1,20 +0,0 @@
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
- });
@@ -1,255 +0,0 @@
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
- });