1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Add a dropdown to tags in edit mode

As discussed in TW Hangout 40
This commit is contained in:
Jermolene 2014-03-26 13:06:11 +00:00
parent 355f467465
commit 45a362c285
2 changed files with 35 additions and 4 deletions

View File

@ -5,10 +5,19 @@ tags: $:/tags/EditTemplate
\define tag-styles()
background-color:$(backgroundColor)$;
\end
<div class="tw-edit-tags"><$fieldmangler><$list filter="[is[current]tags[]sort[title]]" storyview="pop"><$set name="backgroundColor" value={{!!color}}><span style=<<tag-styles>> class="tw-tag-label"><$view field="title" format="text" /><$button message="tw-remove-tag" param={{!!title}} class="btn-invisible tw-remove-tag-button">&times;</$button></span></$set>
</$list>
<div class="tw-edit-tags">
<$fieldmangler>
<$list filter="[is[current]tags[]sort[title]]" storyview="pop" template="$:/core/ui/TagEditTemplate"/>
<div class="tw-edit-add-tag"><span class="tw-add-tag-name"><$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/tagsAutoComplete">> class="tw-edit-texteditor"/></span> <$button popup=<<qualify "$:/state/tagsAutoComplete">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <span class="tw-add-tag-button"><$button message="tw-add-tag" param={{$:/temp/NewTagName}} set="$:/temp/NewTagName" setTo="" class=""><<lingo Tags/Add/Button>></$button></span></div>
<div class="tw-edit-add-tag">
<span class="tw-add-tag-name">
<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/tagsAutoComplete">> class="tw-edit-texteditor"/>
</span> <$button popup=<<qualify "$:/state/tagsAutoComplete">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <span class="tw-add-tag-button">
<$button message="tw-add-tag" param={{$:/temp/NewTagName}} set="$:/temp/NewTagName" setTo="" class="">
<<lingo Tags/Add/Button>>
</$button>
</span>
</div>
<div class="tw-block-dropdown-wrapper">
@ -18,7 +27,13 @@ background-color:$(backgroundColor)$;
<$linkcatcher set="$:/temp/NewTagName" setTo="" message="tw-add-tag">
<$list filter="[!is[shadow]tags[]search{$:/temp/NewTagName}sort[title]]">
<$link><$set name="backgroundColor" value={{!!color}}><span style=<<tag-styles>> class="tw-tag-label"><$view field="title" format="text"/></span></$set></$link>
<$link>
<$set name="backgroundColor" value={{!!color}}>
<span style=<<tag-styles>> class="tw-tag-label">
<$view field="title" format="text"/>
</span>
</$set>
</$link>
</$list>
</$linkcatcher>

View File

@ -0,0 +1,16 @@
title: $:/core/ui/TagEditTemplate
\define tag-styles()
background-color:$(backgroundColor)$;
\end
<$set name="backgroundColor" value={{!!color}}>
<$button popup=<<qualify "$:/state/tagpopup">> class="btn-invisible tw-tag-label" style=<<tag-styles>>>
<$view field="title" format="text" />
<$button message="tw-remove-tag" param={{!!title}} class="btn-invisible tw-remove-tag-button">&times;</$button>
</$button>
</$set>
<$reveal state=<<qualify "$:/state/tagpopup">> type="popup" position="below" animate="yes"><div class="tw-drop-down"><$transclude tiddler="$:/core/ui/ListItemTemplate"/>
<hr>
<$list filter="[is[current]tagging[]]" template="$:/core/ui/ListItemTemplate"/>
</div>
</$reveal>