Show tagging/references as tag-pill

351 views
Skip to first unread message

bimlas

unread,
Oct 31, 2018, 1:53:02 AM10/31/18
to TiddlyWiki
I would like to place tagging/references list from tiddler info as a normal tag on the header of it. I know that `<<tag-pill "Tagging">>` is creating the pill, but I don't know how to define the list and associate with it, because I cannot find the proper action widget. Can somebody help me please?

Mohammad

unread,
Oct 31, 2018, 3:27:16 AM10/31/18
to TiddlyWiki
Look at this

and its example! you can download the code and change as you need

Mohammad

bimlas

unread,
Oct 31, 2018, 4:33:27 AM10/31/18
to TiddlyWiki
Thanks! As I see, it's a modified copy of the original tag template - I wanted to solve it without doing this, but it seems that there is no other way to pass a custom list to a tag pill... :( Maybe creating a custom "list" action widget would solve the problem (which is not modifying a tiddler, but displaying a "predefined" list), but I'm not sure that this is possible...

Mohammad

unread,
Oct 31, 2018, 6:03:35 AM10/31/18
to TiddlyWiki
The original tag template is intact!

This is a copy and revised template and it is part of plugin so there is no conflict with the core code and macro!

-Mohammad

bimlas

unread,
Oct 31, 2018, 6:06:11 AM10/31/18
to TiddlyWiki
Yeah, I understand it but I wanted to assign a list to a tag-pill instead of creating a new template just for it. But it works and I don't know other ways to solve it more simply, so creating a new template seems the only possible solution for me.

bimlas

unread,
Oct 31, 2018, 7:59:41 AM10/31/18
to TiddlyWiki
I made the code and it works, but I think it's a bit too much for making 2 custom pills: I think that "list-tagging-draggable" macro could be used for other listings too, not just tagging[], but I don't have time to improve it (for now).

\define list-reference-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div")
<$set name="tag" value="""$tag$""">
<$list filter="[<tag>backlinks[]$subFilter$]" emptyMessage=<<__emptyMessage__>>>
<$elementTag$ class="tc-menu-list-item">
<$droppable actions=<<list-tagged-draggable-drop-actions>>>
<$elementTag$ class="tc-droppable-placeholder">
&nbsp;
</$elementTag$>
<$elementTag$>
<$transclude tiddler="""$itemTemplate$""">
<$link to={{!!title}}>
<$view field="title"/
>
</$link>
</
$transclude>
</$elementTag$>
</
$droppable>
</$elementTag$>
</
$list>
<$tiddler tiddler="">
<$droppable actions=<<list-tagged-draggable-drop-actions>>>
<$elementTag$ class="tc-droppable-placeholder">
&nbsp;
</$elementTag$>
<$elementTag$ style="height:0.5em;">
</
$elementTag$>
</$droppable>
</
$tiddler>
</$set>
\end

\define tagging-pill()
<$list filter="[<storyTiddler>tagging[]first[]]">
<span class="tc-tag-list-item">
<$set name="transclusion" value=<<qualify "tagging-pill-dropdown">> >
<$macrocall $name="tag-pill-body" tag="Tagging" icon={{!!icon}} colour={{!!color}} palette={{$:/
palette}} element-tag="""$button""" element-attributes="""popup=<<transclusion>> dragFilter='[<storyTiddler>tagging[]]' tag='span'"""/>
<$reveal state=<<transclusion>> type="popup" position="below" animate="yes" class="tc-drop-down">
<$macrocall $name="list-tagged-draggable" tag=<<storyTiddler>>/>
</
$reveal>
</$set>
</
span>
</$list>
\end

\define reference-pill()
<$list filter="[<storyTiddler>backlinks[]first[]]">
<span class="tc-tag-list-item">
<$set name="transclusion" value=<<qualify "reference-pill-dropdown">> >
<$macrocall $name="tag-pill-body" tag="Reference" icon={{!!icon}} colour={{!!color}} palette={{$:/
palette}} element-tag="""$button""" element-attributes="""popup=<<transclusion>> dragFilter='[<storyTiddler>backlinks[]]' tag='span'"""/>
<$reveal state=<<transclusion>> type="popup" position="below" animate="yes" class="tc-drop-down">
<$macrocall $name="list-reference-draggable" tag=<<storyTiddler>>/>
</
$reveal>
</$set>
</
span>
</$list>
\end

bimlas

unread,
Oct 31, 2018, 8:00:54 AM10/31/18
to TiddlyWiki
Forgot to mention the usage: place "<<tagging-pill>>" or "<<reference-pill>>" wherever you want, it will list the current (story) tiddler's links.

TonyM

unread,
Oct 31, 2018, 8:03:19 PM10/31/18
to TiddlyWiki
Bimlas,

I tried to follow the discussion, It seems you are asking to have a tag pill that on clicking does not list the tag but lists tagging/references list (from tiddler info).

To me that at first was asking something to do something its not made for. However a few thoughts came to me

The Following can be used to generate a list of tag pills from any filter {{{ [tag[TableOfContents]] ||$:/core/ui/TagTemplate }}}

So you could use the same filter to find references "[all[current]backlinks[]sort[title]]"

{{{ [all[current]backlinks[]sort[title]] ||$:/core/ui/TagTemplate}}}

Or Tagging

{{{ [all[current]tagging[]] ||$:/core/ui/TagTemplate}}}

This produces a list of tag pills that satisfy the filter(s), You could wrap the above in a popup to get close to what I think is your requirement. I am as yet not confident building popups but you seem to be.

Now on playing with you macros I see what you wanted better now.

I tried replacing your link in the references macro with  {{||$:/core/ui/TagTemplate}} to provide a tag pill for each item in the popup, but I think we need some more popup settings, another state tiddler?  to make this work.

A more generic solution?
I played with your above macros and they are quite useful, they do something similar to what I did in the past, I created a custom tag macro, that allowed me to have a tag pill called Tagging that on click opened the tag pill drop down for the current tiddler. The advantage being you only ever saw a tag pill called "tagging" if the current tiddler was used as a tag elsewhere, and you did not end up with a tag pill that was the same as the current tiddlers title.  We can do this with you macros.

What I am thinking is we could modify your above macro(s) to have a default name of tagging, and a default filter that finds tagging tiddlers, then have the drop down list such tiddlers but with their own tag pill (so you can see what they tag). We could then permit the passing of an alternate name and filter so as to be able to use the same macro to show references or any other useful "filtered" relationship, in a drop-down with a list of tag pills. 

An advantage of the current tag pill drop down is it also lists the actual tiddler, so you can open it as well as the items it lists. Also if you install Andrews Open All Plugin from http://t5a.tiddlyspot.com/#Andrew%20Harrison (in library) you can open all tiddlers that are listed in the tag pill dropdown with one click.


Just some thoughts for you, that may allow you to simplify/generalise your macros. Being able to open all tagging/references in a click, or open the named tiddlers would also be helpful, 

Tony

bimlas

unread,
Nov 2, 2018, 2:33:46 PM11/2/18
to TiddlyWiki
To me that at first was asking something to do something its not made for.

If you look at standard TiddlyWiki, there is a "untagged" tag on the bottom of the More sidebar -> Tags list: this follows virtually the same logic as it does not list members of a tags, but is related to the tag structure.
 
This produces a list of tag pills that satisfy the filter(s), You could wrap the above in a popup to get close to what I think is your requirement. I am as yet not confident building popups but you seem to be.

I do not want to display related tags as tag pills, but it's good to know that this is also possible. Thanks!
 
What I am thinking is we could modify your above macro(s) to have a default name of tagging, and a default filter that finds tagging tiddlers, then have the drop down list such tiddlers but with their own tag pill (so you can see what they tag). We could then permit the passing of an alternate name and filter so as to be able to use the same macro to show references or any other useful "filtered" relationship, in a drop-down with a list of tag pills. 

 Yes, a general macro / template would be best to pass on the pill title (References) and the filter, which compiles the dropdown list.

If I have more time, maybe I'll do it, but ithe current solution is acceptable for me for now.

bimlas

unread,
Nov 3, 2018, 6:36:53 PM11/3/18
to TiddlyWiki
Seems interesting and related to the current thread:

bimlas

unread,
Nov 4, 2018, 10:26:26 AM11/4/18
to TiddlyWiki
I think I wanted to implement this plugin, because it gives me the option to dropdown content:

Enter this code to the top of the http://tobibeer.github.io/tw5-plugins/#Plugins; it will list backlinks of the tiddler as a tag-pill.

<$appear type="popup" show="""<$macrocall $name="tag-pill" tag="References"/>""">
<$list filter="[
<currentTiddler>backlinks[]]"/>
</$appear>


Reply all
Reply to author
Forward
0 new messages