From daf439121bc5b1c47e8c4b089303d5a313b8c928 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 21 Aug 2013 20:51:45 +0100 Subject: [PATCH] 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) --- core/ui/ViewTemplate.tid | 20 ++------------------ core/ui/ViewTemplate/body.tid | 6 ++++++ core/ui/ViewTemplate/subtitle.tid | 4 ++++ core/ui/ViewTemplate/tags.tid | 4 ++++ core/ui/ViewTemplate/title.tid | 12 ++++++++++++ core/wiki/tags/ViewTemplate.tid | 2 ++ 6 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 core/ui/ViewTemplate/body.tid create mode 100644 core/ui/ViewTemplate/subtitle.tid create mode 100644 core/ui/ViewTemplate/tags.tid create mode 100644 core/ui/ViewTemplate/title.tid create mode 100644 core/wiki/tags/ViewTemplate.tid diff --git a/core/ui/ViewTemplate.tid b/core/ui/ViewTemplate.tid index 7defa5b0f..c841b2008 100644 --- a/core/ui/ViewTemplate.tid +++ b/core/ui/ViewTemplate.tid @@ -1,21 +1,5 @@ title: $:/core/ui/ViewTemplate modifier: JeremyRuston -
<$setstyle name="fill" value={{!!color}}><$button popup="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="btn-invisible">{{$:/core/images/info-button}}<$button message="tw-edit-tiddler" class="btn-invisible">{{$:/core/images/edit-button}}<$button message="tw-close-tiddler" class="btn-invisible">{{$:/core/images/close-button}} - -<$transclude target={{!!icon}}/> <$view field="title"/>
- -<$reveal type="nomatch" text="" default="" state="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="tw-tiddler-info" animate="yes"> - -<$transclude template="$:/core/ui/TiddlerInfo"/> - -
- -
<$view field="modifier" format="link"/> <$view field="modified" format="relativedate"/>
- -
<$list filter="[is[current]tags[]]" template="$:/core/ui/TagTemplate" listview="pop" itemClass="tw-tag-list-item"/>
- -
- <$view field="text" format="wikified"> - -
\ No newline at end of file +
<$list filter="[is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]]" hackTemplate=true/> +
diff --git a/core/ui/ViewTemplate/body.tid b/core/ui/ViewTemplate/body.tid new file mode 100644 index 000000000..cda91f5e2 --- /dev/null +++ b/core/ui/ViewTemplate/body.tid @@ -0,0 +1,6 @@ +title: $:/core/ui/ViewTemplate/body +tags: $:/tags/ViewTemplate + +
+<$view field="text" format="wikified"/> +
\ No newline at end of file diff --git a/core/ui/ViewTemplate/subtitle.tid b/core/ui/ViewTemplate/subtitle.tid new file mode 100644 index 000000000..a068c6d09 --- /dev/null +++ b/core/ui/ViewTemplate/subtitle.tid @@ -0,0 +1,4 @@ +title: $:/core/ui/ViewTemplate/subtitle +tags: $:/tags/ViewTemplate + +
<$view field="modifier" format="link"/> <$view field="modified" format="relativedate"/>
diff --git a/core/ui/ViewTemplate/tags.tid b/core/ui/ViewTemplate/tags.tid new file mode 100644 index 000000000..c98cd5b22 --- /dev/null +++ b/core/ui/ViewTemplate/tags.tid @@ -0,0 +1,4 @@ +title: $:/core/ui/ViewTemplate/tags +tags: $:/tags/ViewTemplate + +
<$list filter="[is[current]tags[]]" template="$:/core/ui/TagTemplate" listview="pop" itemClass="tw-tag-list-item"/>
diff --git a/core/ui/ViewTemplate/title.tid b/core/ui/ViewTemplate/title.tid new file mode 100644 index 000000000..152ea6487 --- /dev/null +++ b/core/ui/ViewTemplate/title.tid @@ -0,0 +1,12 @@ +title: $:/core/ui/ViewTemplate/title +tags: $:/tags/ViewTemplate + +
<$setstyle name="fill" value={{!!color}}><$button popup="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="btn-invisible">{{$:/core/images/info-button}}<$button message="tw-edit-tiddler" class="btn-invisible">{{$:/core/images/edit-button}}<$button message="tw-close-tiddler" class="btn-invisible">{{$:/core/images/close-button}} + +<$transclude target={{!!icon}}/> <$view field="title"/>
+ +<$reveal type="nomatch" text="" default="" state="$:/state/tiddlerInfo" qualifyTiddlerTitles="yes" class="tw-tiddler-info" animate="yes"> + +<$transclude template="$:/core/ui/TiddlerInfo"/> + +
\ No newline at end of file diff --git a/core/wiki/tags/ViewTemplate.tid b/core/wiki/tags/ViewTemplate.tid new file mode 100644 index 000000000..5afdf2464 --- /dev/null +++ b/core/wiki/tags/ViewTemplate.tid @@ -0,0 +1,2 @@ +title: $:/tags/ViewTemplate +list: [[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/body]]