Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7

This commit is contained in:
Rune Strand
2016-02-02 10:18:36 +01:00
7 changed files with 21 additions and 24 deletions

View File

@@ -12,22 +12,6 @@
function LockedFieldDirective($timeout, localizationService) {
function link(scope, el, attr, ngModelCtrl) {
//watch the ngModel so we can manually update the textbox view value when it changes
// this ensures that the normal flow (i.e. a user editing the text box) occurs so that
// the parsers, validators and viewchangelisteners execute
scope.$watch("ngModel", function (newValue, oldValue) {
if (newValue !== oldValue) {
//Hack: in order for the pipeline to execute for setViewValue, the underlying $modelValue cannot
// match the value being set with the newValue, so we'll se it to undefined first.
// We could avoid this hack by setting the ngModel of the lockedField input field to a custom
// scope object, but that would mean we'd have to watch that value too in order to set the outer
// ngModelCtrl.$modelValue. It's seems like less overhead to just do this and not have 2x watches.
scope.lockedFieldForm.lockedField.$modelValue = undefined;
scope.lockedFieldForm.lockedField.$render();
}
scope.lockedFieldForm.lockedField.$setViewValue(scope.lockedFieldForm.lockedField.$modelValue);
});
function activate() {

View File

@@ -14,6 +14,7 @@ function valRegex() {
var flags = "";
var regex;
var eventBindings = [];
attrs.$observe("valRegexFlags", function (newVal) {
if (newVal) {
@@ -38,6 +39,12 @@ function valRegex() {
}
});
eventBindings.push(scope.$watch('ngModel', function(newValue, oldValue){
if(newValue && newValue !== oldValue) {
patternValidator(newValue);
}
}));
var patternValidator = function (viewValue) {
if (regex) {
//NOTE: we don't validate on empty values, use required validator for that
@@ -58,8 +65,14 @@ function valRegex() {
}
};
ctrl.$parsers.push(patternValidator);
scope.$on('$destroy', function(){
// unbind watchers
for(var e in eventBindings) {
eventBindings[e]();
}
});
}
};
}
angular.module('umbraco.directives.validation').directive("valRegex", valRegex);
angular.module('umbraco.directives.validation').directive("valRegex", valRegex);

View File

@@ -1,9 +1,9 @@
<div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.Content.CreateController">
<div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.Content.CreateController" ng-cloak>
<div class="umb-pane">
<h5><localize key="create_createUnder">Create a page under</localize> {{currentNode.name}}</h5>
<p class="abstract" ng-hide="allowedTypes">
<p class="abstract" ng-if="allowedTypes && allowedTypes.length === 0">
<localize key="create_noDocumentTypes" />
</p>

View File

@@ -1,4 +1,4 @@
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.DataType.CreateController">
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.DataType.CreateController" ng-cloak>
<div class="umb-pane" ng-if="!model.creatingFolder">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>

View File

@@ -1,4 +1,4 @@
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.DocumentTypes.CreateController">
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.DocumentTypes.CreateController" ng-cloak>
<div class="umb-pane" ng-if="!model.creatingFolder">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>

View File

@@ -1,4 +1,4 @@
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.MediaTypes.CreateController">
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.MediaTypes.CreateController" ng-cloak>
<div class="umb-pane" ng-if="!model.creatingFolder">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>

View File

@@ -1,4 +1,4 @@
<div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.Member.CreateController">
<div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.Member.CreateController" ng-cloak>
<div class="umb-pane">
<h5><localize key="member_createNewMember">Create a new member</localize></h5>