Support descriptions in plugin embeds (fixes #224)
Change-Id: I65f15113c08d464d6eef2af1186e1ebfa7dab225
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index 31f60c8..c6a772e 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -81,7 +81,7 @@
*/
add : function (title, data, cb) {
const b = this._insert('span');
- b.setAttribute('title',title);
+ let desc = title;
if (data !== undefined) {
if (data['cls'] !== undefined) {
@@ -94,9 +94,14 @@
if (data['state'] !== undefined) {
b['state'] = data['state'];
- }
+ };
+
+ if (data['desc'] !== undefined) {
+ desc = data['desc'];
+ };
};
-
+
+ b.setAttribute('title', desc);
b.addE('span').addT(title);
let that = this;
@@ -149,7 +154,7 @@
*/
addToggle : function (title, data, state) {
const b = this._insert('span');
- b.setAttribute('title',title);
+ let desc = title;
if (data != undefined) {
if (data['cls'] !== undefined) {
@@ -158,8 +163,18 @@
data['cls']
);
};
+
+ if (data['icon'] !== undefined) {
+ b.setAttribute('data-icon', data['icon']);
+ };
+
+ if (data['desc'] !== undefined) {
+ desc = data['desc'];
+ };
};
+ b.setAttribute('title',desc);
+
// Set check marker
const check = b.addE('span');
check.classList.add("check", "button-icon");