Created
May 15, 2015 18:55
-
-
Save elchele/a7aef72e0f9a3ec54958 to your computer and use it in GitHub Desktop.
Customization for adding "alias" NavBar links to Sugar 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/* File: ./custom/clients/base/layouts/module-list/module-list.js */ | |
extendsFrom: 'ModuleListLayout', | |
_addDefaultMenus: function() { | |
var moduleList = app.metadata.getModuleNames({filter: 'display_tab', access: 'read'}); | |
moduleList.push('Custom1'); | |
_.each(moduleList, function(module) { | |
this._addMenu(module, true); | |
}, this); | |
}, | |
_addMenu: function(module, sticky) { | |
var menu = {}; | |
var filter = 'favorites'; | |
var alias = false; | |
switch(module) { | |
case 'Custom1': | |
filter = 'all_records'; | |
alias = true; | |
break; | |
} | |
var def = { | |
view: { | |
filter: filter, | |
alias: alias, | |
name: 'module-menu', | |
sticky: sticky, | |
short: false | |
} | |
}; | |
menu.long = this.createComponentFromDef(def, null, module); | |
this.addComponent(menu.long, def); | |
if (!sticky) { | |
return menu; | |
} | |
def = { | |
view: { | |
filter: filter, | |
alias: alias, | |
name: 'module-menu', | |
short: true | |
} | |
}; | |
menu.short = this.createComponentFromDef(def, null, module); | |
this.addComponent(menu.short, def); | |
return menu; | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment