Skip to content

Instantly share code, notes, and snippets.

@dmulvi
Created August 14, 2015 20:52
Show Gist options
  • Save dmulvi/0d42427bbb50b7f07f0b to your computer and use it in GitHub Desktop.
Save dmulvi/0d42427bbb50b7f07f0b to your computer and use it in GitHub Desktop.
create a custom subpanel-list row action
// this file also goes in custom/SUBPANEL_MODULE_NAME/clients/base/views/subpanel-list/
({
extendsFrom: 'SubpanelListView',
initialize: function(options) {
this._super('initialize', [options]);
this.context.on('button:custom_action:click', this.customAction, this);
},
customAction: function() {
// this is where you put your custom code
},
})
<?php
// this file goes in: custom/SUBPANEL_MODULE_NAME/clients/base/views/subpanel-list/
// so for example if you want to update the contacts subpanel that appears on Accounts
// you would sub Contacts for SUBPANEL_MODULE_NAME
$viewdefs['SUBPANEL_MODULE_NAME']['base']['view']['subpanel-list'] = array(
'template' => 'recordlist',
'favorite' => true,
'rowactions' => array(
'actions' => array(
array(
'type' => 'rowaction',
'name' => 'edit_button',
'icon' => 'icon-pencil',
'label' => 'LBL_EDIT_BUTTON',
'event' => 'list:editrow:fire',
'acl_action' => 'edit',
'allow_bwc' => true,
),
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THIS IS THE CUSTOM PART
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
array(
'type' => 'rowaction',
'css_class' => 'btn',
'event' => 'button:custom_action:click',
'icon' => 'icon-bolt', // check out style guide for more options: /#Styleguide/docs/base-icons
'label' => ' Custom SHIZ',
'acl_action' => 'view',
'allow_bwc' => false,
// end custom addition
),
),
),
'last_state' => array(
'id' => 'subpanel-list',
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment