Merge pull request #5285 from pratu16x7/modules-select

[desktop-icons] sort icon select options, fixes frappe/erpnext#10236
This commit is contained in:
Prateeksha Singh 2018-03-27 10:56:14 +05:30 committed by GitHub
commit 410db5b4e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,10 +61,16 @@ frappe.ui.toolbar.ModulesSelect = class {
callback: (r) => {
const icons = r.message.icons;
const user = r.message.user;
resolve(icons.map(icon => {
const uncheck = user ? icon.hidden : icon.blocked;
return { label: icon.value, value: icon.module_name, checked:!uncheck };
}));
resolve(icons
.map(icon => {
const uncheck = user ? icon.hidden : icon.blocked;
return { label: icon.value, value: icon.module_name, checked:!uncheck };
}).sort(function(a, b){
if(a.label < b.label) return -1;
if(a.label > b.label) return 1;
return 0;
})
);
}
});
});