Skip to content

Instantly share code, notes, and snippets.

@dmulvi
Last active August 29, 2015 14:27
Show Gist options
  • Save dmulvi/fd811589c071bb9f9ba9 to your computer and use it in GitHub Desktop.
Save dmulvi/fd811589c071bb9f9ba9 to your computer and use it in GitHub Desktop.
create a custom panel-top row action
({
extendsFrom: 'PanelTopView',
initialize: function(options) {
this._super('initialize', [options]);
var newEvents = {
'click a[name=custom_button]': 'customAction'
}
_.extend(this.events, newEvents);
},
customAction: function() {
// do some custom stuff here
},
})
<?php
$viewdefs['SUBPANEL_MODULE_NAME']['base']['view']['panel-top'] = array(
'buttons' => array(
array(
'type' => 'button',
'css_class' => 'btn-invisible',
'icon' => 'icon-chevron-up',
'tooltip' => 'LBL_TOGGLE_VISIBILITY',
),
array(
'type' => 'actiondropdown',
'name' => 'panel_dropdown',
'css_class' => 'pull-right',
'buttons' => array(
array(
'type' => 'sticky-rowaction',
'icon' => 'icon-plus',
'name' => 'create_button',
'label' => ' ',
'acl_action' => 'create',
'tooltip' => 'LBL_CREATE_BUTTON_LABEL',
),
// THIS IS THE CUSTOM ADDITION
array(
'type' => 'rowaction',
'name' => 'custom_button',
'label' => ' Do Custom Stuff',
'css_class' => 'btn',
'icon' => 'icon-thumbs-up',
),
// END CUSTOM ADDITION
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment