Button
Parameters you can pass
Parameter | Data type | Description |
---|---|---|
name | string | Name of the element to be used in a form |
id | string | Button element ID |
class_name | string | Here you can add your own class (in addition to system classes) |
blue | bool | Pass true if you need a blue button (it's gray by default) |
It supports multiple states by triggering jQuery events on a button element with the .button-input
class.
var $button = $('.button-input');
// starts rotating the loader in the button
// usually called before making an ajax request
$button.trigger('button:load:start');
// stops behavior from above
$button.trigger('button:load:stop');
// activate the button if there are changes in the form
$button.trigger('button:save:enable');
// activate the button if there are no changes in the form
$button.trigger('button:save:disable');
Standard button
self.render({ ref: '/tmpl/controls/button.twig' }, {
name: 'button',
text: 'Default button'
});
Active button
There should be just one active button on the interface, usually this is a button to save the active form.
self.render({ ref: '/tmpl/controls/button.twig' }, {
name: 'button',
text: 'Save',
blue: true
});
Updated about 2 months ago