Skip to content

Instantly share code, notes, and snippets.

@AjayKumar01
Created April 9, 2016 07:20
Show Gist options
  • Save AjayKumar01/e4f2ca6552e857ca657b4eebefea1ec4 to your computer and use it in GitHub Desktop.
Save AjayKumar01/e4f2ca6552e857ca657b4eebefea1ec4 to your computer and use it in GitHub Desktop.
Disabling create and link existing button action in subpanel based on parent module.
({
/* Disabling create and link existing button action in subpanel based on parent module.
* Ajay Kumar
* Path : sugar/custom/modules/Leads/clients/base/views/panel-top/panel-top.js
*/
extendsFrom: 'PanelTopView',
initialize: function(options) {
this._super('initialize', [options]);
var industryValue = this.context.parent.get('model').get("industry");
var parentModule = this.context.parent.get('module');
if (!_.isEqual(industryValue, 'Construction') && _.isEqual(parentModule, "Accounts")) {
_.each(_.first(this.meta.buttons).buttons, function(action) {
action['css_class'] = 'disabled btn';
});
}
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment