extjs-mvc 0.4.0.f → 0.4.0.g

Sign up to get free protection for your applications and to get access to all the features.
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,94 +0,0 @@
1
- /**
2
- * @class ExtMVC.test.TestViewport
3
- * @extends Ext.Viewport
4
- * Specialised Viewport which manages the running and reporting of tests
5
- */
6
- ExtMVC.test.TestViewport = Ext.extend(Ext.Viewport, {
7
-
8
- constructor: function(config) {
9
- config = config || {};
10
-
11
- /**
12
- * @property header
13
- * @type Ext.Panel
14
- * Ext MVC test suite banner Panel
15
- */
16
- this.header = new Ext.Panel({
17
- html : 'Ext MVC Application Test suite',
18
- region: 'north'
19
- });
20
-
21
- /**
22
- * @property statusText
23
- * @type Ext.Toolbar.TextItem
24
- * Displays the current status of the test suite in the bottom toolbar
25
- */
26
- this.statusText = new Ext.Toolbar.TextItem({
27
- text: "Ready"
28
- });
29
-
30
- /**
31
- * @property rerunButton
32
- * @type Ext.Button
33
- * Button attached to the toolbar which re-runs the whole suite
34
- */
35
- this.rerunButton = new Ext.Button({
36
- text : 'Rerun all tests',
37
- iconCls : 'all',
38
- scope : this,
39
- handler : function() {
40
- this.client.runner.runTests();
41
- }
42
- });
43
-
44
- /**
45
- * @property main
46
- * @type Ext.Panel
47
- * The main Ext.grid.GridPanel that shows results from browsers as they come in
48
- */
49
- this.main = new ExtMVC.test.TestGrid({
50
- region: 'center',
51
- tbar : [this.rerunButton],
52
- bbar : [this.statusText]
53
- });
54
-
55
- Ext.applyIf(config, {
56
- layout: 'border',
57
- items: [
58
- this.header,
59
- this.main
60
- ]
61
- });
62
-
63
- ExtMVC.test.TestViewport.superclass.constructor.call(this, config);
64
-
65
- this.initListeners();
66
- },
67
-
68
- /**
69
- * Initialises listeners on the Test Client
70
- */
71
- initListeners: function() {
72
- if (this.client != undefined) {
73
- //used in calculating run time
74
- var startTime;
75
-
76
- this.client.runner.on({
77
- scope: this,
78
- starting: function() {
79
- startTime = new Date();
80
- this.statusText.setText("Running specs");
81
- },
82
- finished: function(stats) {
83
- Ext.apply(stats, {
84
- time : new Date() - startTime,
85
- failingSpecs: new ExtMVC.test.JSpecFormatter(JSpec, JSpec.options).getFailingSpecs()
86
- });
87
-
88
- this.main.store.loadData([stats], true);
89
- this.statusText.setText("Ready");
90
- }
91
- });
92
- }
93
- }
94
- });
@@ -1,29 +0,0 @@
1
- # Defines the build order of Ext MVC. Comments indicated with a hash.
2
- # Each line denotes either a single file, or a directory glob. If a glob, all matching files are included
3
- # (unless they have already been defined)
4
- name: extjs-mvc
5
-
6
- version:
7
-
8
- dependencies:
9
- - ext-3.1.1
10
-
11
- javascripts:
12
- - MVC.js
13
- - App.js
14
- - lib/ClassManager.js
15
- - lib/*.js
16
- - overrides/*.js
17
- - controller/*.js
18
- - model/Model.js
19
- - model/Base.js
20
- - model/adapters/AbstractAdapter.js
21
- - model/adapters/*.js
22
- - model/validations/Validations.js
23
- - model/validations/*.js
24
- - view/*.js
25
- - view/scaffold/ScaffoldFormPanel.js
26
- - view/scaffold/*.js
27
- - testrunner/TestRunner.js
28
- - testrunner/*.js
29
- stylesheets:
@@ -1,16 +0,0 @@
1
- # Defines the build order of Ext MVC. Comments indicated with a hash.
2
- # Each line denotes either a single file, or a directory glob. If a glob, all matching files are included
3
- # (unless they have already been defined)
4
- name: ext
5
-
6
- version: 3.1.1
7
-
8
- dependencies:
9
-
10
- host: http://extjs.cachefly.net
11
-
12
- javascripts:
13
- - adapter/ext/ext-base.js
14
- - ext-all.js
15
-
16
- stylesheets:
@@ -1,184 +0,0 @@
1
- /**
2
- * @class ExtMVC.view.FormWindow
3
- * @extends Ext.Window
4
- * Convenience class for creating a window with a default form. Example:
5
- *
6
- <pre>
7
- MyApp.views.MyFormWindow = Ext.extend(ExtMVC.view.FormWindow, {
8
-
9
- height: 200,
10
-
11
- width : 400,
12
-
13
-
14
- buildForm: function() {
15
- //return your Ext.form.FormPanel here
16
- }
17
- });
18
- </pre>
19
- *
20
- */
21
- ExtMVC.registerView('extmvc', 'formwindow', {
22
- xtype : 'window',
23
- registerXType: 'formwindow',
24
-
25
- modal : true,
26
- height : 230,
27
- width : 400,
28
-
29
- initComponent: function() {
30
- /**
31
- * @property form
32
- * @type Ext.form.FormPanel
33
- * The new POLN form
34
- */
35
- this.form = this.buildForm();
36
-
37
- Ext.apply(this, {
38
- items : [
39
- this.form
40
- ],
41
- layout: 'fit',
42
- closeAction: 'hide',
43
-
44
- /**
45
- * @property maskOnSave
46
- * @type Boolean
47
- * True to add a mask to the field while saving (defaults to true)
48
- */
49
- maskOnSave: true,
50
-
51
- /**
52
- * @property saveMaskMessage
53
- * @type String
54
- * The message to show in the saving mask (defaults to "Saving...")
55
- */
56
- saveMaskMessage: "Saving...",
57
-
58
- /**
59
- * @property hasSaveButton
60
- * @type Boolean
61
- * True to include a save button (defaults to true)
62
- */
63
- hasSaveButton: true,
64
-
65
- /**
66
- * @property hasCancelButton
67
- * @type Boolean
68
- * True to include a cancel button (defaults to true)
69
- */
70
- hasCancelButton: true
71
- });
72
-
73
- //applyIf applies when buttons: [] is passed, which meant there was no way to
74
- //specify any empty set of buttons before
75
- if (!Ext.isArray(this.buttons)) {
76
- Ext.apply(this, {
77
- buttons: this.buildButtons()
78
- });
79
- };
80
-
81
- Ext.Window.prototype.initComponent.apply(this, arguments);
82
- },
83
-
84
- /**
85
- * Builds the buttons added to this form. By default this returns an array containing
86
- * a Save button and a Cancel button, which fire the 'save' and 'cancel' events respectively
87
- * @return {Array} An array of Ext.Button objects or configs
88
- */
89
- buildButtons: function() {
90
- var buttons = [];
91
-
92
- if (this.hasSaveButton === true) buttons.push(this.buildSaveButton());
93
- if (this.hasCancelButton === true) buttons.push(this.buildCancelButton());
94
-
95
- return buttons;
96
- },
97
-
98
- /**
99
- * Builds the Save button config. Override this to provide your own
100
- * @return {Object/Ext.Button} The button config or object
101
- */
102
- buildSaveButton: function() {
103
- return {
104
- text : 'Save',
105
- iconCls: 'save',
106
- scope : this,
107
- handler: this.onSave
108
- };
109
- },
110
-
111
- /**
112
- * Builds the Cancel button config. Override this to provide your own
113
- * @return {Object/Ext.Button} The button config or object
114
- */
115
- buildCancelButton: function() {
116
- return {
117
- text: 'Cancel',
118
- scope: this,
119
- iconCls: 'cancel',
120
- handler: this.onCancel
121
- };
122
- },
123
-
124
- /**
125
- * Creates and returns a FormPanel instance to go inside the window. Override this yourself
126
- * @return {Ext.form.FormPanel} The form panel
127
- */
128
- buildForm: function() {
129
- return new Ext.form.FormPanel({});
130
- },
131
-
132
- /**
133
- * Loads an instance into the form
134
- * @param {GetIt.models.PurchaseOrderLineNote} instance The POLN instance to load
135
- */
136
- loadRecord: function(instance) {
137
- /**
138
- * @property instance
139
- * @type ExtMVC.model.Base
140
- * The instance currently loaded into the form
141
- */
142
- this.instance = instance;
143
-
144
- this.form.form.loadRecord(instance);
145
- },
146
-
147
- /**
148
- * Called when the user clicks the save button
149
- */
150
- onSave: function() {
151
- if (this.maskOnSave === true) this.el.mask(this.saveMaskMessage);
152
-
153
- if (this.instance == undefined || this.instance.newRecord()) {
154
- this.fireEvent('save', this.getFormValues(), this);
155
- } else {
156
- this.fireEvent('save', this.instance, this.getFormValues(), this);
157
- }
158
- },
159
-
160
- /**
161
- * Called when the usre clicks the cancel button. By default this just hides the window
162
- */
163
- onCancel: function() {
164
- this.close();
165
- },
166
-
167
- /**
168
- * Gets form values in a nicer way than getForm.getValues() does - calls getValue on each field.
169
- * See http://www.diloc.de/blog/2008/03/05/how-to-submit-ext-forms-the-right-way/
170
- * @return {Object} key: value pairings of form values
171
- */
172
- getFormValues: function() {
173
- var form = this.form.getForm(),
174
- values = {};
175
-
176
- form.items.each(function(item) {
177
- var func = (typeof item.getSubmitValue == "function") ? 'getSubmitValue' : 'getValue';
178
-
179
- values[item.getName()] = item[func]();
180
- }, this);
181
-
182
- return values;
183
- }
184
- });
@@ -1,211 +0,0 @@
1
- /**
2
- * @class ExtMVC.view.HasManyEditorGridPanel
3
- * @extends Ext.grid.EditorGridPanel
4
- * Provides some sensible defaults for a HasMany editor grid. For example, given the following models:
5
- * ExtMVC.model.define("MyApp.models.User", {
6
- * ...
7
- * hasMany: "Post"
8
- * });
9
- *
10
- * ExtMVC.model.define("MyApp.models.Post", {
11
- * ...
12
- * belongsTo: "User"
13
- * });
14
- *
15
- * Inside the edit User view, if we wanted to be able to quickly edit any of that User's Posts, we can insert
16
- * a HasManyEditorGridPanel like this:
17
- *
18
- * items: [
19
- * {
20
- * xtype: 'hasmany_editorgrid',
21
- * modelObj: userObj,
22
- * association: userObj.posts,
23
- * columns: [... set up editor columns as per a normal EditorGridPanel]
24
- * }
25
- * ]
26
- *
27
- * In the example above, userObj refers to the loaded User instance tied to the edit form. The HasMany editor grid
28
- * automatically listens to afteredit events and saves the HasMany model (Post in this case).
29
- */
30
- ExtMVC.view.HasManyEditorGridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
31
-
32
- initComponent: function() {
33
- Ext.applyIf(this, {
34
- autoScroll: true,
35
- store: this.association.findAll(),
36
- viewConfig: { forceFit: true }
37
- });
38
-
39
- if (this.hasTopToolbar) { this.addTopToolbar(); }
40
-
41
- ExtMVC.view.HasManyEditorGridPanel.superclass.initComponent.apply(this, arguments);
42
-
43
- /**
44
- * Set up listening on the afteredit event. Simply saves the model instance
45
- */
46
- this.on('afteredit', function(args) {
47
- args.record.save({
48
- success: function() {
49
- args.record.commit();
50
- }
51
- });
52
- }, this);
53
-
54
- /**
55
- * Set up listening to selection change to activate the Remove button
56
- */
57
- this.getSelectionModel().on('selectionchange', function(selModel, selection) {
58
- if (this.deleteButton) {
59
- this.deleteButton.enable();
60
- };
61
- }, this);
62
- },
63
-
64
- /**
65
- * @property hasTopToolbar
66
- * @type Boolean
67
- * True to automatically show a toolbar at the top of the grid with Add and Delete buttons (defaults to true)
68
- */
69
- hasTopToolbar: true,
70
-
71
- /**
72
- * @property hasNewButton
73
- * @type Boolean
74
- * True to add a 'New' button to the top toolbar if the top toolbar is present (defaults to true)
75
- */
76
- hasNewButton: true,
77
-
78
- /**
79
- * @property hasDeleteButton
80
- * @type Boolean
81
- * True to add a 'Delete' button to the top toolbar if the top toolbar is present (defaults to true)
82
- */
83
- hasDeleteButton: true,
84
-
85
- /**
86
- * Private.
87
- * Creates a top toolbar and applies it to 'this'. Should only be called from inside initComponent
88
- */
89
- addTopToolbar: function(paramName) {
90
- var items = [];
91
-
92
- if (this.hasNewButton) {
93
- this.newButton = new Ext.Toolbar.Button({
94
- iconCls: 'add',
95
- text: 'Add',
96
- scope: this,
97
- handler: this.onAdd
98
- });
99
-
100
- items.push(this.newButton);
101
- items.push('-');
102
- };
103
-
104
- if (this.hasDeleteButton) {
105
- this.deleteButton = new Ext.Toolbar.Button({
106
- text: 'Remove selected',
107
- disabled: true,
108
- iconCls: 'delete',
109
- scope: this,
110
- handler: this.onDelete
111
- });
112
-
113
- items.push(this.deleteButton);
114
- };
115
-
116
- Ext.applyIf(this, {
117
- tbar: items
118
- });
119
- },
120
-
121
- /**
122
- * @property windowConfig
123
- * @type Object
124
- * Config object passed when creating the New Association window. Override this to customise
125
- * the window that appears
126
- */
127
- windowConfig: {},
128
-
129
- /**
130
- * Called when the Add button is clicked on the top toolbar
131
- */
132
- onAdd: function(btn) {
133
- if (!this.addWindow) {
134
- this.addWindow = new Ext.Window(
135
- Ext.applyIf(this.windowConfig, {
136
- title: 'New',
137
- layout: 'fit',
138
- modal: true,
139
- height: 300,
140
- width: 400,
141
- items: [this.form],
142
- closeAction: 'hide',
143
- buttons: [
144
- {
145
- text: 'Save',
146
- iconCls: 'save',
147
- scope: this,
148
- handler: this.onSaveNew
149
- },
150
- {
151
- text: 'Cancel',
152
- iconCls: 'cancel',
153
- scope: this,
154
- handler: this.onCancelNew
155
- }
156
- ]
157
- })
158
- );
159
- }
160
-
161
- this.addWindow.show();
162
- },
163
-
164
- /**
165
- * Called when a row is selected and the delete button is clicked
166
- */
167
- onDelete: function(btn) {
168
- var record = this.getSelectionModel().selection.record;
169
-
170
- if (record) {
171
- record.destroy({
172
- scope: this,
173
- success: function() {
174
- this.store.reload();
175
- },
176
- failure: function() {
177
- Ext.Msg.alert('Delete failed', "Something went wrong while trying to delete - please try again");
178
- this.store.reload();
179
- }
180
- });
181
- };
182
-
183
- this.deleteButton.disable();
184
- },
185
-
186
- /**
187
- * Called when the user clicks the save button to create a new record
188
- */
189
- onSaveNew: function() {
190
- this.association.create(this.form.getForm().getValues(), {
191
- scope: this,
192
- success: function(modelObj, response) {
193
- this.store.reload();
194
- this.addWindow.hide();
195
- },
196
- failure: function(modelObj, response) {
197
- this.form.getForm().clearInvalid();
198
- this.form.getForm().markInvalid(modelObj.errors.forForm());
199
- }
200
- });
201
- },
202
-
203
- /**
204
- * Called when the user cancels adding a new association model
205
- */
206
- onCancelNew: function(paramName) {
207
- this.addWindow.hide();
208
- }
209
- });
210
-
211
- Ext.reg('hasmany_editorgrid', ExtMVC.view.HasManyEditorGridPanel);