From d3586623c74638a66ebe343b59aad1bafce04a14 Mon Sep 17 00:00:00 2001 From: jveer Date: Mon, 18 Apr 2022 15:41:14 +0200 Subject: [PATCH] Sitemap priority editor changed to slider (#49) (#62) * Sitemap priority editor changed to slider (#49) * Added checkbox to enable/disable the priority change slider * Fix an error with the hiding of the slider property for #49 --- .../sitemapSettings.controller.js | 28 ++++++++++++++----- .../DocumentType/sitemapSettings.html | 25 +++-------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.controller.js b/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.controller.js index 53cf5411..723717e7 100644 --- a/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.controller.js +++ b/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.controller.js @@ -17,7 +17,15 @@ vm.priorityProperty = { label: "Priority", - description: "The priority for this document type" + description: "The priority for this document type", + view: "slider", + enabled: false, + config: { + initVal1: 0, + minVal: 0, + maxVal: 1, + step: 0.1 + } } vm.changeFrequencies = [ @@ -37,7 +45,13 @@ vm.hideFromSitemapProperty.value = settings.hideFromSitemap; vm.changeFrequencyProperty.value = settings.changeFrequency; - vm.priorityProperty.value = settings.priority; + + if (Utilities.isString(settings.priority) || Utilities.isNumber(settings.priority)) { + vm.priorityProperty.value = settings.priority.toString(); + vm.priorityProperty.enabled = true; + } else { + vm.priorityProperty.enabled = false; + } vm.loading = false; }); @@ -49,12 +63,12 @@ contentTypeId: editorState.getCurrent().id, hideFromSitemap: vm.hideFromSitemapProperty.value === "1" ? 1 : 0, changeFrequency: vm.changeFrequencyProperty.value, - priority: vm.priorityProperty.value + priority: vm.priorityProperty.enabled ? vm.priorityProperty.value : undefined }).then(function (response) { - if (response.status !== 200) { - notificationsService.error("Something went wrong while saving sitemap settings"); - } - }); + if (response.status !== 200) { + notificationsService.error("Something went wrong while saving sitemap settings"); + } + }); } $scope.$on("seoSettingsSubmitting", diff --git a/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.html b/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.html index 3e79b9a5..82dbd68c 100644 --- a/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.html +++ b/src/SeoToolkit.Umbraco.Sitemap/App_Plugins/SeoToolkit/Sitemap/Displays/DocumentType/sitemapSettings.html @@ -21,25 +21,8 @@ -
-
-
- - - {{vm.priorityProperty.description}} - -
-
-
- -
-
-
-
+ + + + \ No newline at end of file