ordering prompts in the menu: first the default prompts, then the custom in alphabetical order by "name"
This commit is contained in:
parent
1a10382053
commit
e9cb2fedeb
2 changed files with 4 additions and 2 deletions
|
|
@ -47,6 +47,7 @@ export class mzta_Menus {
|
||||||
this.rootMenu = [];
|
this.rootMenu = [];
|
||||||
this.menu_listeners = {};
|
this.menu_listeners = {};
|
||||||
this.allPrompts = await getPrompts(true);
|
this.allPrompts = await getPrompts(true);
|
||||||
|
this.allPrompts.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
this.allPrompts.forEach((prompt) => {
|
this.allPrompts.forEach((prompt) => {
|
||||||
this.addAction(prompt)
|
this.addAction(prompt)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,9 @@ export async function getPrompts(onlyEnabled = false){
|
||||||
let output = defaultPrompts.concat(customPrompts);
|
let output = defaultPrompts.concat(customPrompts);
|
||||||
if(onlyEnabled){
|
if(onlyEnabled){
|
||||||
output = output.filter(obj => obj.enabled != 0);
|
output = output.filter(obj => obj.enabled != 0);
|
||||||
}
|
}else{ // order only if we are not filtering, the filtering is for the menus and we are ordering there after i18n
|
||||||
output.sort((a, b) => a.id.localeCompare(b.id));
|
output.sort((a, b) => a.id.localeCompare(b.id));
|
||||||
|
}
|
||||||
for(let i=1; i<=output.length; i++){
|
for(let i=1; i<=output.length; i++){
|
||||||
output[i-1].idnum = i;
|
output[i-1].idnum = i;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue