moved t function to global and misc cleanup

This commit is contained in:
2020-04-04 17:06:25 +00:00
parent 90c388ecc2
commit 43de3c8fb0
20 changed files with 242 additions and 286 deletions

View File

@@ -11,7 +11,7 @@
item-disabled="!active"
:error-messages="errors"
:loading="fetching"
:placeholder="t('Search')"
:placeholder="$ay.t('Search')"
:search-input.sync="searchEntry"
:filter="customFilter"
hide-no-data
@@ -107,9 +107,6 @@ export default {
}
},
methods: {
t: function(tKey) {
return window.$gz.translation.get(tKey);
},
hasError: function() {
return this.errors.length > 0;
},
@@ -283,7 +280,7 @@ export default {
if (val.includes(" ")) {
queryTerms = val.split(" ");
if (queryTerms.length > 2) {
vm.errors.push(vm.t("ErrorPickListQueryInvalid"));
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid"));
return;
}
isATwoTermQuery = true;
@@ -318,7 +315,7 @@ export default {
window.$gz._.startsWith(queryTerms[0], "..") &&
window.$gz._.startsWith(queryTerms[1], "..")
) {
vm.errors.push(vm.t("ErrorPickListQueryInvalid"));
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid"));
return;
}
@@ -327,7 +324,7 @@ export default {
!window.$gz._.startsWith(queryTerms[0], "..") &&
!window.$gz._.startsWith(queryTerms[1], "..")
) {
vm.errors.push(vm.t("ErrorPickListQueryInvalid"));
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid"));
return;
}
}
@@ -349,17 +346,6 @@ export default {
this.getList(urlParams);
//------------
}, 300) //did some checking, 200-300ms seems to be the most common debounce time for ajax search queries
},
beforeCreate() {
//check pre-requisites exist just in case
if (window.$gz.errorHandler.devMode()) {
// if (!window.$gz._) {
// throw "tag-picker: $gz._ (lodash) is required and missing";
// }
if (!window.$gz.translation) {
throw "tag-picker: $gz.translation is required and missing";
}
}
}
};
</script>