Adds in some extra propeties on JSON to store localization label for ascending & descending & use correct key for MyWebstie/WebSite Root that was already in lang file

This commit is contained in:
Warren Buckley
2017-01-23 15:53:18 +00:00
parent eefd13547c
commit 072f0d1520

View File

@@ -4,8 +4,11 @@
function QueryBuilderOverlayController($scope, templateQueryResource, localizationService) {
var everything = localizationService.localize("template_allContent");
var myWebsite = localizationService.localize("template_myWebsite");
var myWebsite = localizationService.localize("template_websiteRoot");
var ascendingTranslation = localizationService.localize("template_ascending");
var descendingTranslation = localizationService.localize("template_descending");
var vm = this;
vm.properties = [];
@@ -36,7 +39,13 @@
alias: "",
name: "",
},
direction: "ascending"
direction: "ascending", //This is the value for sorting sent to server
translation: {
currentLabel: ascendingTranslation, //This is the localized UI value in the the dialog
ascending: ascendingTranslation,
descending: descendingTranslation
}
}
};
@@ -77,7 +86,6 @@
vm.contentPickerOverlay = {
view: "contentpicker",
show: true,
submitButtonLabel: "Insert",
submit: function(model) {
var selectedNodeId = model.selection[0].id;
@@ -86,7 +94,7 @@
if (selectedNodeId > 0) {
query.source = { id: selectedNodeId, name: selectedNodeName };
} else {
query.source.name = "My website";
query.source.name = myWebsite;
delete query.source.id;
}
@@ -127,8 +135,10 @@
function changeSortOrder(query) {
if (query.sort.direction === "ascending") {
query.sort.direction = "descending";
query.sort.translation.currentLabel = query.sort.translation.descending;
} else {
query.sort.direction = "ascending";
query.sort.translation.currentLabel = query.sort.translation.ascending;
}
throttledFunc();
}
@@ -137,8 +147,10 @@
query.sort.property = property;
if (property.type === "datetime") {
query.sort.direction = "descending";
query.sort.translation.currentLabel = query.sort.translation.descending;
} else {
query.sort.direction = "ascending";
query.sort.translation.currentLabel = query.sort.translation.ascending;
}
throttledFunc();
}