From 3005c349cadec58419d518bff2838f0fb5d72f28 Mon Sep 17 00:00:00 2001
From: Mark Chapman
Date: Sat, 20 Jan 2018 19:54:57 +0000
Subject: [PATCH 1/5] chore(deps) forms-angular has removed $data as of 390ad16
---
.../b-enhanced-schema-justnameandpostcode.js | 8 ++++----
app/scripts/controllers/b-enhanced-schema.js | 6 +++---
app/scripts/controllers/d-array-example.js | 10 +++++-----
app/scripts/controllers/h_deep_nesting.js | 4 ++--
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/app/scripts/controllers/b-enhanced-schema-justnameandpostcode.js b/app/scripts/controllers/b-enhanced-schema-justnameandpostcode.js
index 0e23192..bb43861 100644
--- a/app/scripts/controllers/b-enhanced-schema-justnameandpostcode.js
+++ b/app/scripts/controllers/b-enhanced-schema-justnameandpostcode.js
@@ -1,10 +1,10 @@
'use strict';
-websiteApp.controller('BEnhancedSchemaJustnameandpostcodeCtrl', ['$scope', '$data', function ($scope, $data) {
+websiteApp.controller('BEnhancedSchemaJustnameandpostcodeCtrl', ['$scope', function ($scope) {
- $scope.record = $data.record;
+ $scope.record = $scope.sharedData.record;
- $data.modelNameDisplay = 'Another override';
- $data.dropDownDisplay = 'Custom 2nd Level';
+ $scope.sharedData.modelNameDisplay = 'Another override';
+ $scope.sharedData.dropDownDisplay = 'Custom 2nd Level';
$scope.contextMenu = [
diff --git a/app/scripts/controllers/b-enhanced-schema.js b/app/scripts/controllers/b-enhanced-schema.js
index 340dda8..a84ebfe 100644
--- a/app/scripts/controllers/b-enhanced-schema.js
+++ b/app/scripts/controllers/b-enhanced-schema.js
@@ -1,10 +1,10 @@
'use strict';
-websiteApp.controller('BEnhancedSchemaCtrl', ['$scope', '$data', '$timeout', function ($scope, $data) {
+websiteApp.controller('BEnhancedSchemaCtrl', ['$scope', function ($scope) {
- $scope.record = $data.record;
+ $scope.record = $scope.sharedData.record;
- $data.dropDownDisplay = 'Custom Dropdown';
+ $scope.sharedData.dropDownDisplay = 'Custom Dropdown';
$scope.doAlert = function (message, showId) {
var alertMessage = message;
diff --git a/app/scripts/controllers/d-array-example.js b/app/scripts/controllers/d-array-example.js
index 5e0c5f5..14ed261 100644
--- a/app/scripts/controllers/d-array-example.js
+++ b/app/scripts/controllers/d-array-example.js
@@ -1,9 +1,9 @@
'use strict';
-websiteApp.controller('DArrayExampleCtrl', ['$scope', '$data', function ($scope, $data) {
+websiteApp.controller('DArrayExampleCtrl', ['$scope', function ($scope) {
- $scope.disableFunctions = $data.disableFunctions;
- $scope.dataEventFunctions = $data.dataEventFunctions;
- $scope.record = $data.record;
+ $scope.disableFunctions = $scope.sharedData.disableFunctions;
+ $scope.dataEventFunctions = $scope.sharedData.dataEventFunctions;
+ $scope.record = $scope.sharedData.record;
$scope.disableFunctions.isDeleteDisabled = function (record, oldRecord) {
// Do not allow records that have previously been "accepted" to be deleted
@@ -14,4 +14,4 @@ websiteApp.controller('DArrayExampleCtrl', ['$scope', '$data', function ($scope,
alert('Here is an example onAfterCreate event. ' + JSON.stringify(data));
};
-}]);
\ No newline at end of file
+}]);
diff --git a/app/scripts/controllers/h_deep_nesting.js b/app/scripts/controllers/h_deep_nesting.js
index 78b73b3..4ac0cb2 100644
--- a/app/scripts/controllers/h_deep_nesting.js
+++ b/app/scripts/controllers/h_deep_nesting.js
@@ -1,7 +1,7 @@
'use strict';
-websiteApp.controller('HDeepNestingCtrl', ['$data', function ($data) {
+websiteApp.controller('HDeepNestingCtrl', ['$scope', function ($scope) {
- $data.modelNameDisplay = 'Nesting (work in early progress - buggy)';
+ $scope.sharedData.modelNameDisplay = 'Nesting (work in early progress - buggy)';
}]);
From f56f4a91368767e7e3ce2f474b1d65d30c382e32 Mon Sep 17 00:00:00 2001
From: Mark Chapman
Date: Sun, 18 Feb 2018 23:05:37 +0000
Subject: [PATCH 2/5] doc(forms) Document changes to client customisation
---
app/partials/forms.html | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/partials/forms.html b/app/partials/forms.html
index 1b83ad5..9fe315f 100644
--- a/app/partials/forms.html
+++ b/app/partials/forms.html
@@ -325,8 +325,12 @@ Client side data events
onAfterDelete function(old)
In all onBefore... cases passing an error back will stop the event completing. There is a trivial example of
- how a data event hook might be used in this controller, which shows
- how such event handlers are set up.
+ how a data event hook might be used in this controller, which shows
+ how such event handlers are set up. In the case of the onBeforeCreate or onBeforeUpdate events the update/create
+ can be handled within the function by passing back the special err of '_update_handled_'. In these cases it will
+ usually be helpful to call baseScope.prepareForSave(cb: (error: string, dataToSave?: any) => void): void
+ to convert the client-side model into the format that needs to be written back to MongoDb.
+
You can also call onRecordChange function(data, old) which is useful for updating calculated fields etc.
From 5be090fba0c3211d9c87e37cc651b8c05edb1206 Mon Sep 17 00:00:00 2001
From: Mark Chapman
Date: Wed, 14 Mar 2018 01:08:34 +0000
Subject: [PATCH 3/5] refactor(gen) Promote examples to its own menu
---
app/partials/examples.html | 4 ++--
app/partials/navbar.html | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/partials/examples.html b/app/partials/examples.html
index 9a975b5..827ba30 100644
--- a/app/partials/examples.html
+++ b/app/partials/examples.html
@@ -5,8 +5,8 @@ Example Forms
-
Below there are several examples of forms and customisations, some of which are linked to from other parts of the documentation.
-
There a number of keyboard short cuts that can be used in the forms. Hit ? to find out more.
+
Below there are several examples of forms and customisations, some of which are linked to from other parts of the documentation. In each case you can view the schema, create a new document or list the collection (and drill down to existing documents). Together they should give a good idea of some of the basic things you can do with forms-angular.
+
There are a number of keyboard short cuts that can be used in the forms. Hit ? to find out more.
| {{model.resourceName | titleCase}} |
diff --git a/app/partials/navbar.html b/app/partials/navbar.html
index 2749712..72f2c30 100644
--- a/app/partials/navbar.html
+++ b/app/partials/navbar.html
@@ -23,6 +23,7 @@
Schemas
Forms
Plugins
+ Examples
More