Skip to content

Commit

Permalink
Sitemap priority editor changed to slider (#49) (#62)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jveer authored Apr 18, 2022
1 parent 86f769b commit d358662
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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;
});
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,8 @@
</div>
</div>

<div class="control-group umb-control-group">
<div class="umb-el-wrap">
<div class="control-header">
<label class="control-label">{{vm.priorityProperty.label}}</label>
<small class="control-description">
{{vm.priorityProperty.description}}
</small>
</div>
<div class="controls">
<div class="umb-property-editor">
<input name="decimalField" class="umb-property-editor umb-number"
type="number"
ng-model="vm.priorityProperty.value"
step="0.1"
min="0"
max="1"
fix-number />
</div>
</div>
</div>
</div>
<umb-property property="vm.priorityProperty">
<umb-toggle checked="vm.priorityProperty.enabled" on-click="vm.priorityProperty.enabled = !vm.priorityProperty.enabled"></umb-toggle>
<umb-property-editor ng-show="vm.priorityProperty.enabled" model="vm.priorityProperty"></umb-property-editor>
</umb-property>
</div>

0 comments on commit d358662

Please sign in to comment.