Created
April 9, 2016 07:24
-
-
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
This file contains hidden or 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
| ({ | |
| /* 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