Skip to content

Instantly share code, notes, and snippets.

@AjayKumar01
Created April 9, 2016 07:24
Show Gist options
  • Select an option

  • Save AjayKumar01/9808366d4bc99368268e06554ecd7776 to your computer and use it in GitHub Desktop.

Select an option

Save AjayKumar01/9808366d4bc99368268e06554ecd7776 to your computer and use it in GitHub Desktop.
Disabling create and link existing button action in subpanel based on parent module and parent module field value
({
/* 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 parentModule = this.context.parent.get('model').module;
var parentCollection = this.context.parent.get('collection');
var parentModel = this.context.parent.get('model');
parentCollection.on('data:sync:complete', function() {
if (_.isEqual(parentModel.get('industry'), 'Construction') && _.isEqual(parentModule, 'Accounts')) {
this.$('a[name=create_button]').addClass('disabled btn');
this.$('a[data-original-title=Actions]').addClass('disabled btn');
}
}, this);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment