diff --git a/core/modules/new_widgets/button.js b/core/modules/new_widgets/button.js index 76f1bf0e5..77224cb7c 100644 --- a/core/modules/new_widgets/button.js +++ b/core/modules/new_widgets/button.js @@ -46,6 +46,8 @@ ButtonWidget.prototype.render = function(parent,nextSibling) { } } domNode.className = classes.join(" "); + // Assign classes + domNode.setAttribute("style",this.style); // Add a click event handler domNode.addEventListener("click",function (event) { var handled = false; @@ -114,6 +116,7 @@ ButtonWidget.prototype.execute = function() { this.hover = this.getAttribute("hover"); this.qualifyTiddlerTitles = this.getAttribute("qualifyTiddlerTitles"); this["class"] = this.getAttribute("class",""); + this.style = this.getAttribute("style"); this.selectedClass = this.getAttribute("selectedClass"); // Qualify tiddler titles if required if(this.qualifyTiddlerTitles) { @@ -134,7 +137,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ ButtonWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.qualifyTiddlerTitles || changedAttributes["class"] || changedAttributes.selectedClass || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup])) { + if(changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.qualifyTiddlerTitles || changedAttributes["class"] || changedAttributes.selectedClass || changedAttributes.style || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup])) { this.refreshSelf(); return true; } diff --git a/core/ui/TagTemplate.tid b/core/ui/TagTemplate.tid index c9fe4d610..ab631f3d7 100644 --- a/core/ui/TagTemplate.tid +++ b/core/ui/TagTemplate.tid @@ -1,6 +1,9 @@ title: $:/core/ui/TagTemplate -<$button popup="$:/state/tagpopup" qualifyTiddlerTitles="yes" class="btn-invisible"><$setstyle name="background-color" value={{!!color}} class="tw-tag-label"><$transclude title={{!!icon}}/> <$view field="title" format="text" /> +\define tag-styles() +background-color:$(backgroundColor)$; +\end +<$setvariable name="backgroundColor" value={{!!color}}><$button popup="$:/state/tagpopup" qualifyTiddlerTitles="yes" class="btn-invisible tw-tag-label" style=<>><$transclude title={{!!icon}}/> <$view field="title" format="text" /> <$reveal state="$:/state/tagpopup" type="popup" position="below" qualifyTiddlerTitles="yes" >
<$view field="title" format="link" /> ----