1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-03 10:43:16 +00:00
TiddlyWiki5/core/ui/EditTemplate/tags.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

41 lines
1.3 KiB
Plaintext

title: $:/core/ui/EditTemplate/tags
tags: $:/tags/EditTemplate
\define lingo-base() $:/language/EditTemplate/
\define tag-styles()
background-color:$(backgroundColor)$;
fill:$(foregroundColor)$;
color:$(foregroundColor)$;
\end
\define tag-body-inner(colour,fallbackTarget,colourA,colourB)
<$vars foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">> backgroundColor="""$colour$""">
<span style=<<tag-styles>> class="tc-tag-label">
<$view field="title" format="text" />
<$button message="tm-remove-tag" param={{!!title}} class="tc-btn-invisible tc-remove-tag-button">&times;</$button>
</span>
</$vars>
\end
\define tag-body(colour,palette)
<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}}/>
\end
\define tag-picker-actions()
<$action-listops
$tiddler=<<currentTiddler>>
$field="tags"
$subfilter="[<tag>] [all[current]tags[]]"
/>
\end
<div class="tc-edit-tags">
<$fieldmangler>
<$list filter="[all[current]tags[]sort[title]]" storyview="pop">
<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/>
</$list>
</$fieldmangler>
<$macrocall $name="tag-picker" actions=<<tag-picker-actions>>/>
</div>