Skip to content

Instantly share code, notes, and snippets.

@mmarum-sugarcrm
Created October 16, 2015 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmarum-sugarcrm/e6f29fbde5db0264bab4 to your computer and use it in GitHub Desktop.
Save mmarum-sugarcrm/e6f29fbde5db0264bab4 to your computer and use it in GitHub Desktop.
Contextual Frame Dashlet javascript
({
/**
* Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
plugins: ['Dashlet'],
/**
* Record ID that is in context
*/
record: undefined,
/**
* Module used
*/
moduleName: undefined,
/**
* Base URL for iFrame (retrieved via config)
*/
url: undefined,
/**
* Height for iFrame element
*/
frameHeight: undefined,
/**
* Overriding initDashlet to setup values needed to render our contextual dashlet
*/
initDashlet: function(view) {
var ctx = this.context;
var model = ctx.get("model");
if (!_.isEmpty(model)) {
this.record = ctx.get("model").get("id");
}
this.moduleName = ctx.get("module");
this.url = this.settings.get("url");
this.frameHeight = this.settings.get("frameHeight");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment