Skip to content

Instantly share code, notes, and snippets.

@elchele
Created August 4, 2014 19:48
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 elchele/eb3a3e07b3c0fd09a5be to your computer and use it in GitHub Desktop.
Save elchele/eb3a3e07b3c0fd09a5be to your computer and use it in GitHub Desktop.
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/Contacts/clients/base/views/record/record.js
*
* Extended RecordView controller for applying custom
* RecordView metadata at initialize time (Sugar 7.2+)
*
*/
extendsFrom: 'RecordView',
initialize: function(options){
// Invoke parent controller 'initialize' method
this._super('initialize', [options]);
// obtain ID value for current user
var u_id = app.user.id;
/* if user is 'Jim', load the metadata for view 'group1', otherwise metadata
for RecordView is applied */
if (u_id == 'seed_jim_id')
{
/* this.meta is metadata for current view (RecordView)
app.metadata.getView() allows us to load metadata of another view */
this.meta = app.metadata.getView(this.module, 'group1');
}
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment