From ebd28c8dc729c2edad409b61e8aa75e0a69f72b8 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 14 Oct 2013 17:35:52 +0100 Subject: [PATCH] Get the tiddler info panel fields list working properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now we can display the fields list as a proper table. We've had to temporarily hack the list widget again… --- core/modules/new_widgets/list.js | 4 +++- core/ui/ListItemTemplate.tid | 5 ++--- core/ui/TiddlerFieldTemplate.tid | 3 +++ core/ui/TiddlerFields.tid | 7 +++---- core/ui/TiddlerInfo.tid | 8 ++++---- themes/tiddlywiki/snowwhite/base.tid | 6 ------ 6 files changed, 15 insertions(+), 18 deletions(-) create mode 100644 core/ui/TiddlerFieldTemplate.tid diff --git a/core/modules/new_widgets/list.js b/core/modules/new_widgets/list.js index 25692a8b0..21e6096bd 100755 --- a/core/modules/new_widgets/list.js +++ b/core/modules/new_widgets/list.js @@ -104,7 +104,9 @@ ListWidget.prototype.makeItemTemplate = function(title) { ]}]; } } - templateTree = [{type: "tiddler", attributes: {title: {type: "string", value: title}}, children: templateTree}] + if(!this.hasAttribute("hackCurrentTiddler")) { + templateTree = [{type: "tiddler", attributes: {title: {type: "string", value: title}}, children: templateTree}] + } } // Return the list item return {type: "listitem", itemTitle: title, children: templateTree}; diff --git a/core/ui/ListItemTemplate.tid b/core/ui/ListItemTemplate.tid index 274fe6c76..008847b31 100644 --- a/core/ui/ListItemTemplate.tid +++ b/core/ui/ListItemTemplate.tid @@ -1,5 +1,4 @@ title: $:/core/ui/ListItemTemplate -
-<$link to={{!!title}}><$view field="title"/> -
+
<$link to={{!!title}}><$view field="title"/> +
\ No newline at end of file diff --git a/core/ui/TiddlerFieldTemplate.tid b/core/ui/TiddlerFieldTemplate.tid new file mode 100644 index 000000000..a91813f40 --- /dev/null +++ b/core/ui/TiddlerFieldTemplate.tid @@ -0,0 +1,3 @@ +title: $:/core/ui/TiddlerFieldTemplate + +<><$view field=<>/> \ No newline at end of file diff --git a/core/ui/TiddlerFields.tid b/core/ui/TiddlerFields.tid index 2f473075f..66153fd89 100644 --- a/core/ui/TiddlerFields.tid +++ b/core/ui/TiddlerFields.tid @@ -1,6 +1,5 @@ title: $:/core/ui/TiddlerFields -\define renderfield(title) -
//$title$//: <$view field="$title$"/>
-\end -<$list filter="[is[current]fields[]sort[title]] -text" macro="renderfield"/> +<$list filter="[is[current]fields[]sort[title]] -text" template="$:/core/ui/TiddlerFieldTemplate" hackCurrentTiddler=true/> + +
diff --git a/core/ui/TiddlerInfo.tid b/core/ui/TiddlerInfo.tid index e84d4ba7a..6cdf2b4dc 100644 --- a/core/ui/TiddlerInfo.tid +++ b/core/ui/TiddlerInfo.tid @@ -5,17 +5,17 @@ title: $:/core/ui/TiddlerInfo
<$reveal type="match" state="$:/state/tiddlerDropDownTabSet" text="refTab" default="refTab" qualifyTiddlerTitles="yes"> -<$list filter="[is[current]backlinks[]sort[title]]" emptyMessage="No tiddlers link to this one"> +<$list filter="[is[current]backlinks[]sort[title]]" emptyMessage="No tiddlers link to this one" template="$:/core/ui/ListItemTemplate"> <$reveal type="match" state="$:/state/tiddlerDropDownTabSet" text="taggingTab" qualifyTiddlerTitles="yes"> -<$list filter="[is[current]tagging[]]" itemClass="tw-menu-list-item" emptyMessage="No tiddlers are tagged with this one"/> +<$list filter="[is[current]tagging[]]" itemClass="tw-menu-list-item" emptyMessage="No tiddlers are tagged with this one" template="$:/core/ui/ListItemTemplate"/> <$reveal type="match" state="$:/state/tiddlerDropDownTabSet" text="listTab" qualifyTiddlerTitles="yes"> -<$list filter="[list{!!title}]" itemClass="tw-menu-list-item" emptyMessage="This tiddler does not have a list"/> +<$list filter="[list{!!title}]" itemClass="tw-menu-list-item" emptyMessage="This tiddler does not have a list" template="$:/core/ui/ListItemTemplate"/> <$reveal type="match" state="$:/state/tiddlerDropDownTabSet" text="listedTab" qualifyTiddlerTitles="yes"> -<$list filter="[is[current]listed[]!is[system]]" itemClass="tw-menu-list-item" emptyMessage="This tiddler is not listed by any others"/> +<$list filter="[is[current]listed[]!is[system]]" itemClass="tw-menu-list-item" emptyMessage="This tiddler is not listed by any others" template="$:/core/ui/ListItemTemplate"/> <$reveal type="match" state="$:/state/tiddlerDropDownTabSet" text="fieldsTab" qualifyTiddlerTitles="yes"> <$transclude title="$:/core/ui/TiddlerFields"/> diff --git a/themes/tiddlywiki/snowwhite/base.tid b/themes/tiddlywiki/snowwhite/base.tid index 972ab1ae5..7f6ad7e2e 100644 --- a/themes/tiddlywiki/snowwhite/base.tid +++ b/themes/tiddlywiki/snowwhite/base.tid @@ -426,16 +426,10 @@ a.tw-tiddlylink-external { } .tw-view-field-name { - vertical-align: top; - display: inline-block; - width: 15%; text-align: right; } .tw-view-field-value { - vertical-align: top; - display: inline-block; - width: 75%; } @media screen {