1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Update the ViewTemplate to be driven by tag

Now the ViewTemplate just renders the current tiddler through each
template tagged `$:/tags/ViewTemplate`. This allows plugins (and users)
to add/remove elements from the ViewTemplate easily, without
overwriting the ViewTemplate itself.

(For @giffmex)
This commit is contained in:
Jeremy Ruston 2013-08-21 20:51:45 +01:00
parent 8cbb98d44d
commit daf439121b
6 changed files with 30 additions and 18 deletions

View File

@ -1,21 +1,5 @@
title: $:/core/ui/ViewTemplate
modifier: JeremyRuston
<div class="tw-tiddler-view"><div class="tw-tiddler-title"><div class="title"><$setstyle name="fill" value={{!!color}}><span class="tw-tiddler-controls"><$button popup="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="btn-invisible">{{$:/core/images/info-button}}</$button><$button message="tw-edit-tiddler" class="btn-invisible">{{$:/core/images/edit-button}}</$button><$button message="tw-close-tiddler" class="btn-invisible">{{$:/core/images/close-button}}</$button>
</span><$transclude target={{!!icon}}/> <$view field="title"/></$setstyle></div>
<$reveal type="nomatch" text="" default="" state="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="tw-tiddler-info" animate="yes">
<$transclude template="$:/core/ui/TiddlerInfo"/>
</$reveal></div>
<div class="tw-subtitle"><$view field="modifier" format="link"/> <$view field="modified" format="relativedate"/></div>
<div class="tw-tags-wrapper"><$list filter="[is[current]tags[]]" template="$:/core/ui/TagTemplate" listview="pop" itemClass="tw-tag-list-item"/></div>
<div class="body">
<$view field="text" format="wikified">
</$view>
</div></div>
<div class="tw-tiddler-view"><$list filter="[is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]]" hackTemplate=true/>
</div>

View File

@ -0,0 +1,6 @@
title: $:/core/ui/ViewTemplate/body
tags: $:/tags/ViewTemplate
<div class="body">
<$view field="text" format="wikified"/>
</div>

View File

@ -0,0 +1,4 @@
title: $:/core/ui/ViewTemplate/subtitle
tags: $:/tags/ViewTemplate
<div class="tw-subtitle"><$view field="modifier" format="link"/> <$view field="modified" format="relativedate"/></div>

View File

@ -0,0 +1,4 @@
title: $:/core/ui/ViewTemplate/tags
tags: $:/tags/ViewTemplate
<div class="tw-tags-wrapper"><$list filter="[is[current]tags[]]" template="$:/core/ui/TagTemplate" listview="pop" itemClass="tw-tag-list-item"/></div>

View File

@ -0,0 +1,12 @@
title: $:/core/ui/ViewTemplate/title
tags: $:/tags/ViewTemplate
<div class="tw-tiddler-title"><div class="title"><$setstyle name="fill" value={{!!color}}><span class="tw-tiddler-controls"><$button popup="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="btn-invisible">{{$:/core/images/info-button}}</$button><$button message="tw-edit-tiddler" class="btn-invisible">{{$:/core/images/edit-button}}</$button><$button message="tw-close-tiddler" class="btn-invisible">{{$:/core/images/close-button}}</$button>
</span><$transclude target={{!!icon}}/> <$view field="title"/></$setstyle></div>
<$reveal type="nomatch" text="" default="" state="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="tw-tiddler-info" animate="yes">
<$transclude template="$:/core/ui/TiddlerInfo"/>
</$reveal></div>

View File

@ -0,0 +1,2 @@
title: $:/tags/ViewTemplate
list: [[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/body]]