From b37197f66aa4ae86ee7fba0393b38a41e96c347f Mon Sep 17 00:00:00 2001 From: Matt Wanchap Date: Thu, 22 Feb 2018 11:46:23 +1000 Subject: [PATCH 1/4] Fix for U4-10821, render alt text attribute from grid image editor, or empty string if null (for screen readers) --- src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml index 09d04219f2..9d29b378b0 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml @@ -13,8 +13,10 @@ url += "&mode=crop"; } } + + var altText = Model.value.altText ?? String.Empty; - @Model.value.caption + @altText if (Model.value.caption != null) { From 08965982fdf0683e786ed9b7802dbcc7328fa056 Mon Sep 17 00:00:00 2001 From: Barry Date: Sun, 25 Feb 2018 05:50:10 +0000 Subject: [PATCH 2/4] Prevent unsaved dialogue appearing when no changes made on FileUpload property editor Addresses this issue in media section (U4-9996) and content (U4-7484) --- .../directives/validation/nodirtycheck.directive.js | 12 ++++++------ .../fileupload/fileupload.controller.js | 3 +++ .../views/propertyeditors/fileupload/fileupload.html | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js index e15f62e8df..104736530f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js @@ -10,12 +10,12 @@ function noDirtyCheck() { require: 'ngModel', link: function (scope, elm, attrs, ctrl) { - elm.focus(function () { - scope.$watch(function() { - ctrl.$pristine = false; - }); - }); - + var alwaysFalse = { + get: function () { return false; }, + set: function () { } + }; + Object.defineProperty(ctrl, '$pristine', alwaysFalse); + Object.defineProperty(ctrl, '$dirty', alwaysFalse); } }; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js index 3c8170e54b..d8a7710bbb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js @@ -130,6 +130,9 @@ function fileUploadController($scope, $element, $compile, imageHelper, fileManag // in the description of this controller, it states that this value isn't actually used for persistence, // but we need to set it so that the editor and the server can detect that it's been changed, and it is used for validation. $scope.model.value = { selectedFiles: newVal.trimEnd(",") }; + + //need to explicity setDirty here as file upload field can't track dirty & we can't use the fileCount (hidden field/model) + $scope.propertyForm.$setDirty(); }); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html index 0905de07f9..63810ac610 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html @@ -31,6 +31,6 @@ - + From da0a1c808a1ef154234d1e79ff0ee35059163b84 Mon Sep 17 00:00:00 2001 From: Matt Wanchap Date: Wed, 28 Feb 2018 11:06:59 +1000 Subject: [PATCH 3/4] Added fallback to caption if no altText, as suggested --- src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml index 9d29b378b0..f821d13f47 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml @@ -14,7 +14,7 @@ } } - var altText = Model.value.altText ?? String.Empty; + var altText = Model.value.altText ?? Model.value.caption ?? String.Empty; @altText From b9ee85dabcfae847598deb52d2dceac722a6a810 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 5 Mar 2018 14:34:36 +0100 Subject: [PATCH 4/4] String ->string --- src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml index f821d13f47..ea79ce41ad 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml @@ -14,7 +14,7 @@ } } - var altText = Model.value.altText ?? Model.value.caption ?? String.Empty; + var altText = Model.value.altText ?? Model.value.caption ?? string.Empty; @altText