diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/valserver.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/valserver.directive.js index fa98ccc572..61459bd62a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/valserver.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/valserver.directive.js @@ -11,11 +11,10 @@ function valServer(serverValidationManager) { restrict: "A", link: function (scope, element, attr, ctrl) { - if (!scope.model || !scope.model.alias){ + if (!scope.alias){ throw "valServer can only be used in the scope of a content property object"; } - var currentProperty = scope.model; - + var fieldName = scope.$eval(attr.valServer); if (!fieldName) { //eval returned nothing so just use the string @@ -36,7 +35,7 @@ function valServer(serverValidationManager) { }); //subscribe to the server validation changes - serverValidationManager.subscribe(currentProperty.alias, fieldName, function (isValid, propertyErrors, allErrors) { + serverValidationManager.subscribe(scope.alias, fieldName, function (isValid, propertyErrors, allErrors) { if (!isValid) { ctrl.$setValidity('valServer', false); //assign an error msg property to the current validator @@ -53,7 +52,7 @@ function valServer(serverValidationManager) { // NOTE: this is very important otherwise when this controller re-binds the previous subscriptsion will remain // but they are a different callback instance than the above. element.bind('$destroy', function () { - serverValidationManager.unsubscribe(currentProperty.alias, fieldName); + serverValidationManager.unsubscribe(scope.alias, fieldName); }); } }; diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js index f08acf8cbe..3a738439df 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/_utils.js @@ -33,7 +33,7 @@ label: "Content", id: 2, properties: [ - { alias: "valTest", label: "Validation test", view: "validationtest", value: "" }, + { alias: "valTest", label: "Validation test", view: "validationtest", value: "asdfasdf" }, { alias: "bodyText", label: "Body Text", description: "Here you enter the primary article contents", view: "rte", value: "
askjdkasj lasjd
" }, { alias: "textarea", label: "textarea", view: "textarea", value: "ajsdka sdjkds", config: { rows: 4 } }, { alias: "map", label: "Map", view: "googlemaps", value: "37.4419,-122.1419", config: { mapType: "ROADMAP", zoom: 4 } }, 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 5c99e75dd4..381b7a9f8d 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 @@ -11,6 +11,8 @@ function ContentEditController($scope, $routeParams, $location, contentResource, /** adds the custom controls to the generic props tab above the user props */ function configureGenericPropertiesTab(genericPropsTab, content) { + //NOTE: I don't really think we need these here, we should just chuck them on the mock data, then we can make + // sure these are just returned from the server with the correct localized strings. genericPropsTab.properties.splice(0, 0, { label: 'Created', diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js index 6ad8c7ab59..6f22454786 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js @@ -7,8 +7,8 @@ var values = []; //this will be comma delimited - if ($scope.model && $scope.model.value && (typeof $scope.model.value == "string")) { - var splitVals = $scope.model.value.split(","); + if ($scope.value && (typeof $scope.value == "string")) { + var splitVals = $scope.value.split(","); //set the values of our object for (var i = 0; i < splitVals.length; i++) { values.push({ @@ -35,7 +35,7 @@ csv.push(newValue[v].value); } //write the csv value back to the property - $scope.model.value = csv.join(); + $scope.value = csv.join(); }, true); }; diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/CsvEditor.html b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/CsvEditor.html index a301800a4d..f34dde1bfd 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/CsvEditor.html +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/CsvEditor.html @@ -11,5 +11,5 @@ - {{model.value}} + {{value}} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/PostcodeEditor.html b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/PostcodeEditor.html index c1d1e5ea7a..8a4ac7f6be 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/PostcodeEditor.html +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/PostcodeEditor.html @@ -1,10 +1,10 @@ - Enter a postcode for country {{model.config.country}} + Enter a postcode for country {{config.country}}
- + val-postcode="config.country"/> {{propertyForm.myPackage_postcode.errorMsg}} {{propertyForm.myPackage_postcode.errorMsg}} diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/RegexEditor.html b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/RegexEditor.html index 8e4304fbc2..25c80e39c4 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/RegexEditor.html +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Views/RegexEditor.html @@ -1,12 +1,12 @@ - Value in the format of {{model.config}} + Value in the format of {{config}}
Required!