Merge pull request #3429 from umbraco/temp8-231-send-to-publish-with-variants
v8 - send to publish with variants
This commit is contained in:
@@ -5,74 +5,78 @@
|
||||
* @description Used to show validation warnings for a editor sub view to indicate that the section content has validation errors in its data.
|
||||
* In order for this directive to work, the valFormManager directive must be placed on the containing form.
|
||||
**/
|
||||
(function() {
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function valSubViewDirective() {
|
||||
function valSubViewDirective() {
|
||||
|
||||
function controller($scope, $element) {
|
||||
//expose api
|
||||
return {
|
||||
valStatusChanged: function(args) {
|
||||
if (!args.form.$valid) {
|
||||
var subViewContent = $element.find(".ng-invalid");
|
||||
function controller($scope, $element) {
|
||||
//expose api
|
||||
return {
|
||||
valStatusChanged: function (args) {
|
||||
|
||||
if (subViewContent.length > 0) {
|
||||
$scope.model.hasError = true;
|
||||
$scope.model.errorClass = args.showValidation ? 'show-validation' : null;
|
||||
} else {
|
||||
$scope.model.hasError = false;
|
||||
$scope.model.errorClass = null;
|
||||
//TODO: Verify this is correct, does $scope.model ever exist?
|
||||
if ($scope.model) {
|
||||
if (!args.form.$valid) {
|
||||
var subViewContent = $element.find(".ng-invalid");
|
||||
|
||||
if (subViewContent.length > 0) {
|
||||
$scope.model.hasError = true;
|
||||
$scope.model.errorClass = args.showValidation ? 'show-validation' : null;
|
||||
} else {
|
||||
$scope.model.hasError = false;
|
||||
$scope.model.errorClass = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$scope.model.hasError = false;
|
||||
$scope.model.errorClass = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$scope.model.hasError = false;
|
||||
$scope.model.errorClass = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
//if there are no containing form or valFormManager controllers, then we do nothing
|
||||
if (!ctrl || !angular.isArray(ctrl) || ctrl.length !== 2 || !ctrl[0] || !ctrl[1]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var valFormManager = ctrl[1];
|
||||
scope.model.hasError = false;
|
||||
|
||||
//listen for form validation changes
|
||||
valFormManager.onValidationStatusChanged(function (evt, args) {
|
||||
if (!args.form.$valid) {
|
||||
|
||||
var subViewContent = el.find(".ng-invalid");
|
||||
|
||||
if (subViewContent.length > 0) {
|
||||
scope.model.hasError = true;
|
||||
} else {
|
||||
scope.model.hasError = false;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
scope.model.hasError = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
require: ['?^^form', '?^^valFormManager'],
|
||||
restrict: "A",
|
||||
link: link,
|
||||
controller: controller
|
||||
};
|
||||
|
||||
return directive;
|
||||
}
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
//if there are no containing form or valFormManager controllers, then we do nothing
|
||||
if (!ctrl || !angular.isArray(ctrl) || ctrl.length !== 2 || !ctrl[0] || !ctrl[1]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var valFormManager = ctrl[1];
|
||||
scope.model.hasError = false;
|
||||
|
||||
//listen for form validation changes
|
||||
valFormManager.onValidationStatusChanged(function (evt, args) {
|
||||
if (!args.form.$valid) {
|
||||
|
||||
var subViewContent = el.find(".ng-invalid");
|
||||
|
||||
if (subViewContent.length > 0) {
|
||||
scope.model.hasError = true;
|
||||
} else {
|
||||
scope.model.hasError = false;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
scope.model.hasError = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
require: ['?^^form', '?^^valFormManager'],
|
||||
restrict: "A",
|
||||
link: link,
|
||||
controller: controller
|
||||
};
|
||||
|
||||
return directive;
|
||||
}
|
||||
|
||||
angular.module('umbraco.directives').directive('valSubView', valSubViewDirective);
|
||||
angular.module('umbraco.directives').directive('valSubView', valSubViewDirective);
|
||||
|
||||
})();
|
||||
|
||||
@@ -102,11 +102,8 @@
|
||||
|
||||
//It was decided to just put these messages into the normal status messages.
|
||||
|
||||
var msg = "Unauthorized access to URL: <br/><i>" + rejection.config.url.split('?')[0] + "</i>";
|
||||
if (rejection.config.data) {
|
||||
msg += "<br/> with data: <br/><i>" + angular.toJson(rejection.config.data) + "</i><br/>Contact your administrator for information.";
|
||||
}
|
||||
|
||||
var msg = "Unauthorized access to URL: <br/><i>" + rejection.config.url.split('?')[0] + "</i><br/>Contact your administrator for information.";
|
||||
|
||||
notificationsService.error("Authorization error", msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ContentSortController($scope, $filter, contentResource, navigationService) {
|
||||
function ContentSortController($scope, $filter, $routeParams, contentResource, navigationService) {
|
||||
|
||||
var vm = this;
|
||||
var parentId = $scope.currentNode.parentId ? $scope.currentNode.parentId : "-1";
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
function onInit() {
|
||||
vm.loading = true;
|
||||
contentResource.getChildren(id)
|
||||
contentResource.getChildren(id, { cultureName: $routeParams.cculture ? $routeParams.cculture : $routeParams.mculture })
|
||||
.then(function(data){
|
||||
vm.children = data.items;
|
||||
vm.loading = false;
|
||||
@@ -79,4 +79,4 @@
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Editors.Content.SortController", ContentSortController);
|
||||
})();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user