Removes the editorContextService - there is zero reason to have this and it will also mean that the content item that is being stored is never released from memory. Changes form event names to formSubmitting and formSubmitted
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
angular.module('umbraco.services')
|
||||
.service('editorContextService', function () {
|
||||
var context;
|
||||
return {
|
||||
getContext:function () {
|
||||
return context;
|
||||
},
|
||||
setContext:function (value) {
|
||||
context = value;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-repeat="contentType in listViewAllowedTypes">
|
||||
<a
|
||||
href="#/content/content/edit/{{content.id}}?doctype={{contentType.alias}}&create=true">
|
||||
href="#/content/content/edit/{{contentId}}?doctype={{contentType.alias}}&create=true">
|
||||
<i class="icon-{{contentType.cssClass}}"></i>
|
||||
{{contentType.name}}
|
||||
</a>
|
||||
@@ -41,7 +41,7 @@
|
||||
<td><a href="#" ng-click="sort('Owner')" prevent-default>Editor <i class="icon-sort"></i></a></td>
|
||||
<td with="20"><form class="pull-right" novalidate>
|
||||
<i class="icon-search"></i>
|
||||
<input type="text" ng-model="options.filter" on-keyup="reloadView(content.id)">
|
||||
<input type="text" ng-model="options.filter" on-keyup="reloadView(contentId)">
|
||||
</form></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
angular.module("umbraco")
|
||||
.controller("Umbraco.PropertyEditors.RelatedLinksController",
|
||||
function ($rootScope, $scope, dialogService, $routeParams, contentResource, contentTypeResource, editorContextService, notificationsService) {
|
||||
function ($rootScope, $scope, dialogService) {
|
||||
|
||||
$scope.newCaption = '';
|
||||
$scope.newLink = 'http://';
|
||||
|
||||
@@ -62,7 +62,7 @@ angular.module("umbraco")
|
||||
$scope.model.value = editor.getContent();
|
||||
});
|
||||
});
|
||||
var unsubscribe = $scope.$on("saving", function () {
|
||||
var unsubscribe = $scope.$on("formSubmitting", function () {
|
||||
$scope.model.value = editor.getContent();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user