Skip to content

Commit

Permalink
Feat: allow tags have its ViewTemplate tag and cascade (#8462)
Browse files Browse the repository at this point in the history
* feat: allow tags have its ViewTemplate tag and cascade

* feat: quick addition of subtitle cascade

* docs: tag subtitle cascade control panel

* Update ControlPanel.multids
  • Loading branch information
linonetwo authored Aug 1, 2024
1 parent 5c43512 commit 57d3e8e
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 11 deletions.
4 changes: 4 additions & 0 deletions core/language/en-GB/ControlPanel.multids
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,7 @@ ViewTemplateBody/Caption: View Template Body
ViewTemplateBody/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the body of a tiddler.
ViewTemplateTitle/Caption: View Template Title
ViewTemplateTitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the title of a tiddler.
ViewTemplateSubtitle/Caption: View Template Subtitle
ViewTemplateSubtitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the subtitle of a tiddler.
ViewTemplateTags/Caption: View Template Tags
ViewTemplateTags/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the tags area of a tiddler.
9 changes: 9 additions & 0 deletions core/ui/ControlPanel/Cascades/ViewTemplateSubtitle.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: $:/core/ui/ControlPanel/ViewTemplateSubtitle
tags: $:/tags/ControlPanel/Cascades
caption: {{$:/language/ControlPanel/ViewTemplateSubtitle/Caption}}

\define lingo-base() $:/language/ControlPanel/ViewTemplateSubtitle/

<<lingo Hint>>

{{$:/tags/ViewTemplateSubtitleFilter||$:/snippets/ListTaggedCascade}}
9 changes: 9 additions & 0 deletions core/ui/ControlPanel/Cascades/ViewTemplateTags.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: $:/core/ui/ControlPanel/ViewTemplateTags
tags: $:/tags/ControlPanel/Cascades
caption: {{$:/language/ControlPanel/ViewTemplateTags/Caption}}

\define lingo-base() $:/language/ControlPanel/ViewTemplateTags/

<<lingo Hint>>

{{$:/tags/ViewTemplateTagsFilter||$:/snippets/ListTaggedCascade}}
8 changes: 1 addition & 7 deletions core/ui/ViewTemplate/subtitle.tid
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ title: $:/core/ui/ViewTemplate/subtitle
tags: $:/tags/ViewTemplate

\whitespace trim
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-subtitle">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler">
<$transclude tiddler=<<subtitleTiddler>> mode="inline"/><$list-join>&nbsp;</$list-join>
</$list>
</div>
</$reveal>
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateSubtitleFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/subtitle/default]] }}} />
10 changes: 10 additions & 0 deletions core/ui/ViewTemplate/subtitle/default.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: $:/core/ui/ViewTemplate/subtitle/default

\whitespace trim
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-subtitle">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler">
<$transclude tiddler=<<subtitleTiddler>> mode="inline"/><$list-join>&nbsp;</$list-join>
</$list>
</div>
</$reveal>
4 changes: 1 addition & 3 deletions core/ui/ViewTemplate/tags.tid
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ title: $:/core/ui/ViewTemplate/tags
tags: $:/tags/ViewTemplate

\whitespace trim
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
</$reveal>
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateTagsFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/tags/default]] }}} />
11 changes: 11 additions & 0 deletions core/ui/ViewTemplate/tags/default.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: $:/core/ui/ViewTemplate/tags/default

\whitespace trim
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-tags-wrapper">
<$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Tags]!has[draft.of]]">
<$transclude mode="inline"/>
</$list>
</div>
</$reveal>
4 changes: 4 additions & 0 deletions languages/zh-Hans/ControlPanel.multids
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,7 @@ ViewTemplateBody/Caption: 查看模板主体
ViewTemplateBody/Hint: 默认的查看模板使用此规则级联,动态选择模板以显示条目的主体。
ViewTemplateTitle/Caption: 查看模板标题
ViewTemplateTitle/Hint: 默认的查看模板使用此规则级联,动态选择模板以显示条目的标题。
ViewTemplateSubtitle/Caption: 查看模板副标题
ViewTemplateSubtitle/Hint: 默认的查看模板使用此规则级联,动态选择模板以显示条目的副标题。
ViewTemplateTags/Caption: 查看模板标签区
ViewTemplateTags/Hint: 默认的查看模板使用此规则级联,动态选择模板以显示条目的标签区域。
6 changes: 5 additions & 1 deletion languages/zh-Hant/ControlPanel.multids
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,8 @@ Tools/Download/Full/Caption: 下載完整副本
ViewTemplateBody/Caption: 檢視範本主體
ViewTemplateBody/Hint: 預設的檢視範本使用此規則級聯,動態選擇範本以顯示條目的主體。
ViewTemplateTitle/Caption: 檢視範本標題
ViewTemplateTitle/Hint: 預設的檢視範本使用此規則級聯,動態選擇範本以顯示條目的標題。
ViewTemplateTitle/Hint: 預設的檢視範本使用此規則級聯,動態選擇範本以顯示條目的標題。
ViewTemplateSubtitle/Caption: 檢視範本副標題
ViewTemplateSubtitle/Hint: 預設的檢視範本使用此規則級聯,動態選擇範本以顯示條目的副標題。
ViewTemplateTags/Caption: 檢視範本標籤
ViewTemplateTags/Hint: 預設的檢視範本使用此規則級聯,動態選擇範本以顯示條目的標籤。

0 comments on commit 57d3e8e

Please sign in to comment.