Add possibility to define icons for plugin-buttons
Change-Id: I4a30fa72953ae6136d5c5056c992bdadac135ffe
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index 01e5a1c..f7acfb7 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -31,9 +31,9 @@
/**
- * Upgrade this object to another object,
+ * Upgrade this object to another object,
* while private data stays intact.
- *
+ *
* @param {Object} An object with properties.
*/
upgradeTo : function (props) {
@@ -46,15 +46,21 @@
/**
* Add button in order
- *
+ *
* Returns the button element
*/
- add : function (title, classes, cb) {
+ // TODO: Accept an object instead of a list
+ add : function (title, classes, cb, icon) {
var b = this._element.addE('span');
b.setAttribute('title',title);
if (classes !== undefined) {
b.classList.add.apply(b.classList, classes);
};
+
+ if (icon !== undefined){
+ b.setAttribute('data-icon', icon);
+ };
+
b.addE('span').addT(title);
var that = this;
@@ -75,7 +81,7 @@
/**
* Add button that spawns a list in order.
- *
+ *
* Returns the list object.
*/
addList : function (title, classes, itemClass = defaultItemClass) {
@@ -136,8 +142,8 @@
},
/**
- * Bind an object to all callbacks of the button group.
- * To get the button element inside the callback,
+ * Bind an object to all callbacks of the button group.
+ * To get the button element inside the callback,
* use this.button
*/
bind : function (obj) {