mastercontroller 1.1.14 → 1.1.15
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.
- package/MasterRouter.js +14 -11
- package/package.json +1 -1
package/MasterRouter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
// version 1.0.
|
|
3
|
+
// version 1.0.17
|
|
4
4
|
|
|
5
5
|
var master = require('./MasterControl');
|
|
6
6
|
var tools = require('./MasterTools');
|
|
@@ -128,7 +128,7 @@ class MasterRouter {
|
|
|
128
128
|
|
|
129
129
|
var route = {
|
|
130
130
|
type: type.toLowerCase(),
|
|
131
|
-
path: path.replace(/^\/|\/$/g, ''),
|
|
131
|
+
path: path.replace(/^\/|\/$/g, '').toLowerCase(),
|
|
132
132
|
toController :pathList[0].replace(/^\/|\/$/g, ''),
|
|
133
133
|
toAction: pathList[1],
|
|
134
134
|
constraint : constraint
|
|
@@ -140,10 +140,10 @@ class MasterRouter {
|
|
|
140
140
|
|
|
141
141
|
resources: function(routeName){ // function to add to list of routes using resources bulk
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
$that._routes[$that.currentRouteName].routes.push({
|
|
145
145
|
type: "get",
|
|
146
|
-
path: routeName,
|
|
146
|
+
path: routeName.toLowerCase(),
|
|
147
147
|
toController :routeName,
|
|
148
148
|
toAction: "index",
|
|
149
149
|
constraint : null
|
|
@@ -151,7 +151,7 @@ class MasterRouter {
|
|
|
151
151
|
|
|
152
152
|
$that._routes[$that.currentRouteName].routes.push({
|
|
153
153
|
type: "get",
|
|
154
|
-
path: routeName,
|
|
154
|
+
path: routeName.toLowerCase(),
|
|
155
155
|
toController :routeName,
|
|
156
156
|
toAction: "new",
|
|
157
157
|
constraint : null
|
|
@@ -159,7 +159,7 @@ class MasterRouter {
|
|
|
159
159
|
|
|
160
160
|
$that._routes[$that.currentRouteName].routes.push({
|
|
161
161
|
type: "post",
|
|
162
|
-
path: routeName,
|
|
162
|
+
path: routeName.toLowerCase(),
|
|
163
163
|
toController :routeName,
|
|
164
164
|
toAction: "create",
|
|
165
165
|
constraint : null
|
|
@@ -168,7 +168,7 @@ class MasterRouter {
|
|
|
168
168
|
$that._routes[$that.currentRouteName].routes.push({
|
|
169
169
|
// pages/3
|
|
170
170
|
type: "get",
|
|
171
|
-
path: routeName + "/:id",
|
|
171
|
+
path: routeName.toLowerCase() + "/:id",
|
|
172
172
|
toController :routeName,
|
|
173
173
|
toAction: "show",
|
|
174
174
|
constraint : null
|
|
@@ -176,7 +176,7 @@ class MasterRouter {
|
|
|
176
176
|
|
|
177
177
|
$that._routes[$that.currentRouteName].routes.push({
|
|
178
178
|
type: "get",
|
|
179
|
-
path: routeName + "/:id/" + "edit",
|
|
179
|
+
path: routeName.toLowerCase() + "/:id/" + "edit",
|
|
180
180
|
toController :routeName,
|
|
181
181
|
toAction: "edit",
|
|
182
182
|
constraint : null
|
|
@@ -184,7 +184,7 @@ class MasterRouter {
|
|
|
184
184
|
|
|
185
185
|
$that._routes[$that.currentRouteName].routes.push({
|
|
186
186
|
type: "put",
|
|
187
|
-
path: routeName + "/:id",
|
|
187
|
+
path: routeName.toLowerCase() + "/:id",
|
|
188
188
|
toController :routeName,
|
|
189
189
|
toAction: "update",
|
|
190
190
|
constraint : null
|
|
@@ -192,7 +192,7 @@ class MasterRouter {
|
|
|
192
192
|
|
|
193
193
|
$that._routes[$that.currentRouteName].routes.push({
|
|
194
194
|
type: "delete",
|
|
195
|
-
path: routeName + "/:id",
|
|
195
|
+
path: routeName.toLowerCase() + "/:id",
|
|
196
196
|
toController :routeName,
|
|
197
197
|
toAction: "destroy",
|
|
198
198
|
constraint : null
|
|
@@ -238,6 +238,9 @@ class MasterRouter {
|
|
|
238
238
|
|
|
239
239
|
tools.combineObjects(requestObject, master.requestList);
|
|
240
240
|
var Control = require(`${currentRoute.root}/app/controllers/${tools.firstLetterlowercase(requestObject.toController)}Controller`);
|
|
241
|
+
if(Control === null){
|
|
242
|
+
Control = require(`${currentRoute.root}/app/controllers/${tools.firstLetterUppercase(requestObject.toController)}Controller`);
|
|
243
|
+
}
|
|
241
244
|
tools.combineObjectPrototype(Control, master.controllerList);
|
|
242
245
|
Control.prototype.__namespace = Control.name;
|
|
243
246
|
var control = new Control(requestObject);
|
|
@@ -262,7 +265,7 @@ class MasterRouter {
|
|
|
262
265
|
load(rr){ // load the the router
|
|
263
266
|
var $that = this;
|
|
264
267
|
var requestObject = Object.create(rr);
|
|
265
|
-
requestObject.pathName = requestObject.pathName.replace(/^\/|\/$/g, '');
|
|
268
|
+
requestObject.pathName = requestObject.pathName.replace(/^\/|\/$/g, '').toLowerCase();
|
|
266
269
|
|
|
267
270
|
var _loadEmit = new EventEmitter();
|
|
268
271
|
|
package/package.json
CHANGED