diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js index ad1b268618..5e260f93ee 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js @@ -67,7 +67,7 @@ function valPropertyMsg(serverValidationManager) { }, true); //listen for the forms saving event - scope.$on("saving", function(ev, args) { + scope.$on("formSubmitting", function (ev, args) { showValidation = true; if (hasError && scope.errorMsg === "") { var err; @@ -83,7 +83,7 @@ function valPropertyMsg(serverValidationManager) { }); //listen for the forms saved event - scope.$on("saved", function (ev, args) { + scope.$on("formSubmitted", function (ev, args) { showValidation = false; scope.errorMsg = ""; formCtrl.$setValidity('valPropertyMsg', true); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valshowvalidation.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valshowvalidation.directive.js index 058b86d667..f408b2be5f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valshowvalidation.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valshowvalidation.directive.js @@ -12,8 +12,8 @@ function valShowValidation(serverValidationManager) { link: function (scope, element, attr, ctrl) { var className = attr.valShowValidation ? attr.valShowValidation : "show-validation"; - var savingEventName = attr.savingEvent ? attr.savingEvent : "saving"; - var savedEvent = attr.savedEvent ? attr.savingEvent : "saved"; + var savingEventName = attr.savingEvent ? attr.savingEvent : "formSubmitting"; + var savedEvent = attr.savedEvent ? attr.savingEvent : "formSubmitted"; //we should show validation if there are any msgs in the server validation collection if (serverValidationManager.items.length > 0) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valtogglemsg.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valtogglemsg.directive.js index 4ebbb79200..e5ec11bf5f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valtogglemsg.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valtogglemsg.directive.js @@ -44,7 +44,7 @@ function valToggleMsg(serverValidationManager) { }); //listen for the saving event (the result is a callback method which is called to unsubscribe) - var unsubscribeSaving = scope.$on("saving", function (ev, args) { + var unsubscribeSaving = scope.$on("formSubmitting", function (ev, args) { showValidation = true; if (formCtrl[attr.valMsgFor].$error[attr.valToggleMsg]) { element.show(); @@ -59,7 +59,7 @@ function valToggleMsg(serverValidationManager) { }); //listen for the saved event (the result is a callback method which is called to unsubscribe) - var unsubscribeSaved = scope.$on("saved", function (ev, args) { + var unsubscribeSaved = scope.$on("formSubmitted", function (ev, args) { showValidation = false; element.hide(); }); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index 25faf0b75c..9df21c6b24 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -2,7 +2,7 @@ /** * @ngdoc service * @name umbraco.services.contentEditingHelper -* @description A helper service for content controllers when editing/creating/saving content. +* @description A helper service for content/media/member controllers when editing/creating/saving content. **/ function contentEditingHelper($location, $routeParams, notificationsService, serverValidationManager, dialogService) { @@ -212,7 +212,7 @@ function contentEditingHelper($location, $routeParams, notificationsService, ser notificationsService.showNotification(args.newContent.notifications[i]); } - args.scope.$broadcast("saved", { scope: args.scope }); + args.scope.$broadcast("formSubmitted", { scope: args.scope }); if (!this.redirectToCreatedContent(args.redirectId ? args.redirectId : args.newContent.id)) { //we are not redirecting because this is not new content, it is existing content. In this case diff --git a/src/Umbraco.Web.UI.Client/src/common/services/editorContext.service.js b/src/Umbraco.Web.UI.Client/src/common/services/editorContext.service.js deleted file mode 100644 index b4f5f7ae91..0000000000 --- a/src/Umbraco.Web.UI.Client/src/common/services/editorContext.service.js +++ /dev/null @@ -1,12 +0,0 @@ -angular.module('umbraco.services') -.service('editorContextService', function () { - var context; - return { - getContext:function () { - return context; - }, - setContext:function (value) { - context = value; - } - }; - }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/insertmacro.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/insertmacro.controller.js index 96dd79226f..40b609fa17 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/insertmacro.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/insertmacro.controller.js @@ -82,7 +82,7 @@ function InsertMacroController($scope, entityResource, macroResource, umbPropEdi if ($scope.wizardStep === "paramSelect") { //we need to broadcast the saving event for the toggle validators to work - $scope.$broadcast("saving"); + $scope.$broadcast("formSubmitting"); } //ensure the drop down is dirty so the styles validate diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js index 072faf8b20..9cc33f63a3 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js @@ -6,7 +6,7 @@ * @description * The controller for the content editor */ -function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) { +function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager) { //initialize the file manager fileManager.clearFiles(); @@ -17,7 +17,6 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont .then(function(data) { $scope.loaded = true; $scope.content = data; - editorContextService.setContext($scope.content); }); } else { @@ -27,7 +26,6 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont $scope.loaded = true; $scope.content = data; - editorContextService.setContext($scope.content); navigationService.syncPath(data.path.split(",")); //in one particular special case, after we've created a new item we redirect back to the edit @@ -59,7 +57,7 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont $scope.saveAndPublish = function () { $scope.setStatus("Publishing..."); - $scope.$broadcast("saving", { scope: $scope }); + $scope.$broadcast("formSubmitting", { scope: $scope }); var currentForm = angularHelper.getRequiredCurrentForm($scope); @@ -112,7 +110,7 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont var deferred = $q.defer(); $scope.setStatus("Saving..."); - $scope.$broadcast("saving", { scope: $scope }); + $scope.$broadcast("formSubmitting", { scope: $scope }); var currentForm = angularHelper.getRequiredCurrentForm($scope); diff --git a/src/Umbraco.Web.UI.Client/src/views/datatype/datatype.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/datatype/datatype.edit.controller.js index f887141014..c45c4f6331 100644 --- a/src/Umbraco.Web.UI.Client/src/views/datatype/datatype.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/datatype/datatype.edit.controller.js @@ -80,7 +80,7 @@ function DataTypeEditController($scope, $routeParams, $location, dataTypeResourc }); $scope.save = function () { - $scope.$broadcast("saving", { scope: $scope }); + $scope.$broadcast("formSubmitting", { scope: $scope }); //ensure there is a form object assigned. var currentForm = angularHelper.getRequiredCurrentForm($scope); diff --git a/src/Umbraco.Web.UI.Client/src/views/media/media.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/media.edit.controller.js index d10da4d8bc..b36c7cefe9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/media.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/media/media.edit.controller.js @@ -6,7 +6,7 @@ * @description * The controller for the media editor */ -function mediaEditController($scope, $routeParams, mediaResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService, $timeout) { +function mediaEditController($scope, $routeParams, mediaResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, $timeout) { //initialize the file manager fileManager.clearFiles(); @@ -18,7 +18,6 @@ function mediaEditController($scope, $routeParams, mediaResource, notificationsS $scope.loaded = true; $scope.content = data; - editorContextService.setContext($scope.content); }); } else { @@ -26,9 +25,7 @@ function mediaEditController($scope, $routeParams, mediaResource, notificationsS .then(function (data) { $scope.loaded = true; $scope.content = data; - - editorContextService.setContext($scope.content); - + //in one particular special case, after we've created a new item we redirect back to the edit // route but there might be server validation errors in the collection which we need to display // after the redirect, so we will bind all subscriptions which will show the server validation errors @@ -50,7 +47,7 @@ function mediaEditController($scope, $routeParams, mediaResource, notificationsS $scope.setStatus("Saving..."); - $scope.$broadcast("saving", { scope: $scope }); + $scope.$broadcast("formSubmitting", { scope: $scope }); var currentForm = angularHelper.getRequiredCurrentForm($scope); //don't continue if the form is invalid diff --git a/src/Umbraco.Web.UI.Client/src/views/member/member.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/member/member.edit.controller.js index adc1a85796..6d3e85a04f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/member/member.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/member/member.edit.controller.js @@ -6,7 +6,7 @@ * @description * The controller for the member editor */ -function MemberEditController($scope, $routeParams, $location, $q, $timeout, $window, memberResource, entityResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) { +function MemberEditController($scope, $routeParams, $location, $q, $timeout, $window, memberResource, entityResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager) { //initialize the file manager fileManager.clearFiles(); @@ -17,24 +17,26 @@ function MemberEditController($scope, $routeParams, $location, $q, $timeout, $wi .then(function(data) { $scope.loaded = true; $scope.content = data; - editorContextService.setContext($scope.content); }); } else { //so, we usually refernce all editors with the Int ID, but with members we have //a different pattern, adding a route-redirect here to handle this: //isNumber doesnt work here since its seen as a string - if($routeParams.id && $routeParams.id.length < 9){ - entityResource.getById($routeParams.id, "Member").then(function(entity){ + + //TODO: Why is this here - I don't understand why this would ever be an integer? This will not work when we support non-umbraco membership providers. + + if ($routeParams.id && $routeParams.id.length < 9) { + entityResource.getById($routeParams.id, "Member").then(function(entity) { $location.path("member/member/edit/" + entity.key); }); - }else{ + } + else { //we are editing so get the content item from the server memberResource.getByKey($routeParams.id) .then(function(data) { $scope.loaded = true; $scope.content = data; - editorContextService.setContext($scope.content); //in one particular special case, after we've created a new item we redirect back to the edit // route but there might be server validation errors in the collection which we need to display @@ -60,7 +62,7 @@ function MemberEditController($scope, $routeParams, $location, $q, $timeout, $wi var deferred = $q.defer(); $scope.setStatus("Saving..."); - $scope.$broadcast("saving", { scope: $scope }); + $scope.$broadcast("formSubmitting", { scope: $scope }); var currentForm = angularHelper.getRequiredCurrentForm($scope); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js index 0c879d0164..1e15947b5d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js @@ -72,7 +72,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordCont //listen for the saved event, when that occurs we'll //change to changing = false; - $scope.$on("saved", function() { + $scope.$on("formSubmitted", function () { $scope.changing = false; resetModel(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js index 3c4ff59e39..97bfc49d2d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js @@ -1,6 +1,6 @@ angular.module("umbraco") .controller("Umbraco.PropertyEditors.ListViewController", - function ($rootScope, $scope, $routeParams, contentResource, contentTypeResource, editorContextService, notificationsService, iconHelper) { + function ($rootScope, $scope, $routeParams, contentResource, contentTypeResource, notificationsService, iconHelper) { $scope.selected = []; $scope.actionInProgress = false; @@ -194,13 +194,13 @@ angular.module("umbraco") } }; - if($routeParams.id){ + if ($routeParams.id) { $scope.pagination = new Array(100); $scope.listViewAllowedTypes = contentTypeResource.getAllowedTypes($routeParams.id); $scope.reloadView($routeParams.id); - $scope.content = editorContextService.getContext(); - + $scope.contentId = $routeParams.id; + } }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html index 3fe0fae2dc..dfd82c01f8 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html @@ -11,7 +11,7 @@