Extend view widget so that it falls back to its content if the field/property is empty or missing

print-window-tiddler
Jermolene 2013-11-09 17:30:06 +00:00
rodzic 6f1c9d88cc
commit a7bb331412
4 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -30,9 +30,14 @@ ViewWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
var textNode = this.document.createTextNode(this.text);
parent.insertBefore(textNode,nextSibling);
this.domNodes.push(textNode);
if(this.text) {
var textNode = this.document.createTextNode(this.text);
parent.insertBefore(textNode,nextSibling);
this.domNodes.push(textNode);
} else {
this.makeChildWidgets();
this.renderChildren(parent,nextSibling);
}
};
/*

Wyświetl plik

@ -1,7 +1,7 @@
title: $:/core/ui/PageMacros
\define tabs(tabsList,default,state:"$:/currentTab")
<div class="tw-tab-buttons"><$list filter="$tabsList$" variable="currentTab"><$button set=<<qualify "$state$">> setTo=<<currentTab>> default="$default$" selectedClass="tw-tab-selected"><$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/> </$button>
<div class="tw-tab-buttons"><$list filter="$tabsList$" variable="currentTab"><$button set=<<qualify "$state$">> setTo=<<currentTab>> default="$default$" selectedClass="tw-tab-selected"><$view tiddler=<<currentTab>> field="caption"><$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/></$view> </$button>
</$list>
</div>
<div class="tw-tab-divider">

Wyświetl plik

@ -15,3 +15,4 @@ This release has several bug fixes:
* Improved deployment scripts
* Made the modifier field in the subtitle be a link
* Styling improvements for the CodeMirror plugin
* Improved the ViewWidget so that it falls back to displaying its content if the field/property is missing or empty

Wyświetl plik

@ -11,7 +11,7 @@ The view widget displays the contents of a tiddler field in a specified format.
! Content and Attributes
The content of the `<$view>` widget is ignored.
The content of the `<$view>` widget is displayed if the field or property is missing or empty.
|!Attribute |!Description |
|tiddler |The title of the tiddler (defaults to the [[WidgetVariable: currentTiddler]]) |