1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 06:43:15 +00:00
TiddlyWiki5/core/ui/TagManager.tid
Jermolene f07e0f981a Refactor tag template into an underlying macro
By refactoring the innards of the tag template into global macros, we
make it easier to re-use elements of the tag template
2016-11-28 19:17:25 +00:00

91 lines
2.6 KiB
Plaintext

title: $:/TagManager
icon: $:/core/images/tag-button
color: #bbb
caption: {{$:/language/TagManager/Caption}}
\define lingo-base() $:/language/TagManager/
\define iconEditorTab(type)
<$list filter="[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[sort[title]] +[$type$is[system]]">
<$link to={{!!title}}>
<$transclude/> <$view field="title"/>
</$link>
</$list>
\end
\define iconEditor(title)
<div class="tc-drop-down-wrapper">
<$button popup=<<qualify "$:/state/popup/icon/$title$">> class="tc-btn-invisible tc-btn-dropdown">{{$:/core/images/down-arrow}}</$button>
<$reveal state=<<qualify "$:/state/popup/icon/$title$">> type="popup" position="belowleft" text="" default="">
<div class="tc-drop-down">
<$linkcatcher to="$title$!!icon">
<<iconEditorTab type:"!">>
<hr/>
<<iconEditorTab type:"">>
</$linkcatcher>
</div>
</$reveal>
</div>
\end
\define qualifyTitle(title)
$title$$(currentTiddler)$
\end
\define toggleButton(state)
<$reveal state="$state$" type="match" text="closed" default="closed">
<$button set="$state$" setTo="open" class="tc-btn-invisible tc-btn-dropdown" selectedClass="tc-selected">
{{$:/core/images/info-button}}
</$button>
</$reveal>
<$reveal state="$state$" type="match" text="open" default="closed">
<$button set="$state$" setTo="closed" class="tc-btn-invisible tc-btn-dropdown" selectedClass="tc-selected">
{{$:/core/images/info-button}}
</$button>
</$reveal>
\end
<table class="tc-tag-manager-table">
<tbody>
<tr>
<th><<lingo Colour/Heading>></th>
<th class="tc-tag-manager-tag"><<lingo Tag/Heading>></th>
<th><<lingo Count/Heading>></th>
<th><<lingo Icon/Heading>></th>
<th><<lingo Info/Heading>></th>
</tr>
<$list filter="[tags[]!is[system]sort[title]]">
<tr>
<td><$edit-text field="color" tag="input" type="color"/></td>
<td><$macrocall $name="tag" tag=<<currentTiddler>>/></td>
<td><$count filter="[all[current]tagging[]]"/></td>
<td>
<$macrocall $name="iconEditor" title={{!!title}}/>
</td>
<td>
<$macrocall $name="toggleButton" state=<<qualifyTitle "$:/state/tag-manager/">> />
</td>
</tr>
<tr>
<td></td>
<td colspan="4">
<$reveal state=<<qualifyTitle "$:/state/tag-manager/">> type="match" text="open" default="">
<table>
<tbody>
<tr><td><<lingo Colour/Heading>></td><td><$edit-text field="color" tag="input" type="text" size="9"/></td></tr>
<tr><td><<lingo Icon/Heading>></td><td><$edit-text field="icon" tag="input" size="45"/></td></tr>
</tbody>
</table>
</$reveal>
</td>
</tr>
</$list>
<tr>
<td></td>
<td>
{{$:/core/ui/UntaggedTemplate}}
</td>
<td>
<small class="tc-menu-list-count"><$count filter="[untagged[]!is[system]] -[tags[]]"/></small>
</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>