diff --git a/core/ui/EditTemplate/tags.tid b/core/ui/EditTemplate/tags.tid index e806fd90c..557d1ebdf 100644 --- a/core/ui/EditTemplate/tags.tid +++ b/core/ui/EditTemplate/tags.tid @@ -2,11 +2,13 @@ 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=<> backgroundColor="""$colour$"""> > class="tc-tag-label"> @@ -15,39 +17,24 @@ color:$(foregroundColor)$; \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=<> + $field="tags" + $subfilter="[] [all[current]tags[]]" +/> +\end +
<$fieldmangler> <$list filter="[all[current]tags[]sort[title]]" storyview="pop"> <$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/> - -
- -<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<> class="tc-edit-texteditor tc-popup-handle"/> - <$button popup=<> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}} -<$button message="tm-add-tag" param={{$:/temp/NewTagName}} set="$:/temp/NewTagName" setTo="" class=""> -<> - - -
- -
-<$reveal state=<> type="nomatch" text="" default=""> -
-<$linkcatcher set="$:/temp/NewTagName" setTo="" message="tm-add-tag"> -<$list filter="[tags[]!is[system]search:title{$:/temp/NewTagName}sort[]]"> -{{||$:/core/ui/Components/tag-link}} - -
-<$list filter="[tags[]is[system]search:title{$:/temp/NewTagName}sort[]]"> -{{||$:/core/ui/Components/tag-link}} - - -
- -
-
\ No newline at end of file +<$macrocall $name="tag-picker" actions=<>/> + diff --git a/core/ui/TagManager.tid b/core/ui/TagManager.tid index fe3489dc9..eeb2135c5 100644 --- a/core/ui/TagManager.tid +++ b/core/ui/TagManager.tid @@ -1,6 +1,7 @@ title: $:/TagManager icon: $:/core/images/tag-button color: #bbb +caption: {{$:/language/TagManager/Caption}} \define lingo-base() $:/language/TagManager/ \define iconEditorTab(type) @@ -51,7 +52,7 @@ $title$$(currentTiddler)$ <$list filter="[tags[]!is[system]sort[title]]"> <$edit-text field="color" tag="input" type="color"/> -<$transclude tiddler="$:/core/ui/TagTemplate"/> +<$macrocall $name="tag" tag=<>/> <$count filter="[all[current]tagging[]]"/> <$macrocall $name="iconEditor" title={{!!title}}/> diff --git a/core/ui/TagTemplate.tid b/core/ui/TagTemplate.tid index f302d8f3d..569e6ad0f 100644 --- a/core/ui/TagTemplate.tid +++ b/core/ui/TagTemplate.tid @@ -1,30 +1,3 @@ title: $:/core/ui/TagTemplate -\define tag-styles() -background-color:$(backgroundColor)$; -fill:$(foregroundColor)$; -color:$(foregroundColor)$; -\end - -\define tag-body-inner(colour,fallbackTarget,colourA,colourB) -<$vars foregroundColor=<> backgroundColor="""$colour$"""> -<$button popup=<> class="tc-btn-invisible tc-tag-label" style=<>> -<$transclude tiddler={{!!icon}}/> <$view field="title" format="text" /> - -<$reveal state=<> type="popup" position="below" animate="yes" class="tc-drop-down"><$transclude tiddler="$:/core/ui/ListItemTemplate"/> -<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem"> -<$transclude tiddler=<>/> - -
-<$list filter="[all[current]tagging[]]" template="$:/core/ui/ListItemTemplate"/> - - -\end - -\define tag-body(colour,palette) - -<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}}/> - -\end - -<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/> +<$macrocall $name="tag" tag=<>/> diff --git a/core/wiki/macros/tag-picker.tid b/core/wiki/macros/tag-picker.tid new file mode 100644 index 000000000..aaea75632 --- /dev/null +++ b/core/wiki/macros/tag-picker.tid @@ -0,0 +1,41 @@ +title: $:/core/macros/tag-picker +tags: $:/tags/Macro + +\define tag-button() +<$button class="tc-btn-invisible" tag="a"> +$(actions)$ +<$action-deletetiddler $tiddler="$:/temp/NewTagName"/> +<$macrocall $name="tag-pill" tag=<>/> + +\end + +\define tag-picker(actions) +<$set name="actions" value="""$actions$"""> +
+ +<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<> class="tc-edit-texteditor tc-popup-handle"/> + <$button popup=<> class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}} +<$set name="tag" value={{$:/temp/NewTagName}}> +<$button set="$:/temp/NewTagName" setTo="" class=""> +$actions$ +<$action-deletetiddler $tiddler="$:/temp/NewTagName"/> +{{$:/language/EditTemplate/Tags/Add/Button}} + + + +
+
+<$reveal state=<> type="nomatch" text="" default=""> +
+<$list filter="[tags[]!is[system]search:title{$:/temp/NewTagName}sort[]]" variable="tag"> +<> + +
+<$list filter="[tags[]is[system]search:title{$:/temp/NewTagName}sort[]]" variable="tag"> +<> + +
+ +
+ +\end diff --git a/core/wiki/macros/tag.tid b/core/wiki/macros/tag.tid index b65bfc046..dc23f3238 100644 --- a/core/wiki/macros/tag.tid +++ b/core/wiki/macros/tag.tid @@ -1,6 +1,44 @@ title: $:/core/macros/tag tags: $:/tags/Macro -\define tag(tag) -{{$tag$||$:/core/ui/TagTemplate}} +\define tag-pill-styles() +background-color:$(backgroundColor)$; +fill:$(foregroundColor)$; +color:$(foregroundColor)$; +\end + +\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions) +<$vars foregroundColor=<> backgroundColor="""$colour$"""> +<$element-tag$ $element-attributes$ class="tc-tag-label tc-btn-invisible" style=<>> +$actions$<$transclude tiddler="""$icon$"""/> <$view tiddler="""$tag$""" field="title" format="text" /> + + +\end + +\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions) +<$macrocall $name="tag-pill-inner" tag="""$tag$""" icon="""$icon$""" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} element-tag="""$element-tag$""" element-attributes="""$element-attributes$""" actions="""$actions$"""/> +\end + +\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"") + +<$macrocall $name="tag-pill-body" tag="""$tag$""" icon={{$tag$!!icon}} colour={{$tag$!!color}} palette={{$:/palette}} element-tag="""$element-tag$""" element-attributes="""$element-attributes$""" actions="""$actions$"""/> + +\end + +\define tag(tag) + +<$set name="transclusion" value="""$tag$"""> +<$macrocall $name="tag-pill-body" tag="""$tag$""" icon={{$tag$!!icon}} colour={{$tag$!!color}} palette={{$:/palette}} element-tag="""$button""" element-attributes="""popup=<>"""/> +<$reveal state=<> type="popup" position="below" animate="yes" class="tc-drop-down"> +<$tiddler tiddler="""$tag$"""> +<$transclude tiddler="$:/core/ui/ListItemTemplate"/> +<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem"> +<$transclude tiddler=<>/> + +
+<$list filter="[all[current]tagging[]]" template="$:/core/ui/ListItemTemplate"/> + + + +
\end diff --git a/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid b/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid new file mode 100644 index 000000000..eae5cf1b9 --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid @@ -0,0 +1,15 @@ +caption: tag-picker +created: 20161128191316701 +modified: 20161128191435641 +tags: Macros [[Core Macros]] +title: tag-picker Macro +type: text/vnd.tiddlywiki + +The <<.def tag-picker>> [[macro|Macros]] generates a combination of a text box and a button that allows a tag to be selected and added. + +!! Parameters + +;actions +: Action widgets to be triggered when the pill is clicked + +<<.macro-examples "tag-picker">> diff --git a/editions/tw5.com/tiddlers/macros/tag-pill_Macro.tid b/editions/tw5.com/tiddlers/macros/tag-pill_Macro.tid new file mode 100644 index 000000000..e48206c71 --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/tag-pill_Macro.tid @@ -0,0 +1,21 @@ +caption: tag-pill +created: 20161128190930538 +modified: 20161128191220364 +tags: Macros [[Core Macros]] +title: tag-pill Macro +type: text/vnd.tiddlywiki + +The <<.def tag-pill>> [[macro|Macros]] generates a static tag pill showing a specified tag, but without the dropdown action provided by the [[tag Macro]]. + +!! Parameters + +;tag +: The title of the tag +;element-tag +: The element name to be used for the pill (defaults to "span") +;element-attributes +: Additional attributes for the pill element +;actions +: Action widgets to be triggered when the pill is clicked + +<<.macro-examples "tag-pill">>