Skip to content
This repository was archived by the owner on Jun 18, 2018. It is now read-only.

Fix grid editors in nested content #116

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.DocTypePickerController", [
angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.DocTypePickerController", [

"$scope",
"Our.Umbraco.NestedContent.Resources.NestedContentResources",
Expand All @@ -8,7 +8,7 @@
$scope.add = function () {
$scope.model.value.push({
// As per PR #4, all stored content type aliases must be prefixed "nc" for easier recognition.
// For good measure we'll also prefix the tab alias "nc"
// For good measure we'll also prefix the tab alias "nc"
ncAlias: "",
ncTabAlias: "",
nameTemplate: ""
Expand Down Expand Up @@ -305,7 +305,7 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest
var initIfAllScaffoldsHaveLoaded = function () {
// Initialize when all scaffolds have loaded
if ($scope.model.config.contentTypes.length == scaffoldsLoaded) {
// Because we're loading the scaffolds async one at a time, we need to
// Because we're loading the scaffolds async one at a time, we need to
// sort them explicitly according to the sort order defined by the data type.
var contentTypeAliases = [];
_.each($scope.model.config.contentTypes, function (contentType) {
Expand Down Expand Up @@ -356,7 +356,7 @@ angular.module("umbraco").controller("Our.Umbraco.NestedContent.Controllers.Nest
var prop = tab.properties[p];
prop.propertyAlias = prop.alias;
prop.alias = $scope.model.alias + "___" + prop.alias;
// Force validation to occur server side as this is the
// Force validation to occur server side as this is the
// only way we can have consistancy between mandatory and
// regex validation messages. Not ideal, but it works.
prop.validation = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
angular.module("umbraco.directives").directive('nestedContentEditor', [

function () {
"Our.Umbraco.NestedContent.Services.NestedContentCallbacks",

function (NestedContentCallbacks) {

var link = function ($scope) {

Expand Down Expand Up @@ -29,6 +31,9 @@
var unsubscribe = $scope.$on("ncSyncVal", function (ev, args) {
if (args.id === $scope.model.id) {

// Run callback
NestedContentCallbacks.call("ncBeforeFormSubmitting", { scope: $scope });

// Tell inner controls we are submitting
$scope.$broadcast("formSubmitting", { scope: $scope });

Expand Down Expand Up @@ -94,4 +99,4 @@
// },
// link: link
// }
//});
//});
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
angular.module('umbraco.services').factory('Our.Umbraco.NestedContent.Services.NestedContentCallbacks',

function() {
// Define available callbacks
var callbacks = {
'ncBeforeFormSubmitting': []
};

return {

callbacks: callbacks,

call: function(cb, args) {
cb = this.callbacks[cb];
if ( cb && Array.isArray(cb) && cb.length ) {
cb.forEach(function(func) {
typeof func != "function" || func(args);
});
}
}

};
}

);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
'~/App_Plugins/NestedContent/Js/nestedcontent.filters.js',
'~/App_Plugins/NestedContent/Js/nestedcontent.resources.js',
'~/App_Plugins/NestedContent/Js/nestedcontent.directives.js',
'~/App_Plugins/NestedContent/Js/nestedcontent.controllers.js'
'~/App_Plugins/NestedContent/Js/nestedcontent.controllers.js',
'~/App_Plugins/NestedContent/Js/nestedcontent.services.js'
],
"css" : [
"~/App_Plugins/NestedContent/Css/nestedcontent.css"
Expand Down