[TW5] Creating a button that only shows up when a tiddler has a certain tag

110 views
Skip to first unread message

Andrew Whiting

unread,
Sep 8, 2016, 4:34:36 PM9/8/16
to TiddlyWiki
Hi all,

I want a button at the bottom of tiddlers with a certain tag that, when clicked, will remove that tag and then disappear. Similar to what I've done here but removing a tag rather than cycling through:

~~~
<$list filter="[[{{!!title}}]]+[tag[Review]!days:created[-5]]
[tag[Review2]!days:created[-12]]
[tag[Review3]!days:created[-21]]
[tag[Review4]!days:created[-35]]
[tag[Review5]!days:created[-60]]
[tag[Review6]!days:created[-100]]
[tag[Review7]!days:created[-150]]
[tag[Review8]!days:created[-230]]
[tag[Review9]!days:created[-365]]
">
<br>
<hr>
<$button>Mark as Reviewed
<$action-listops $tags="+[cycle[Review Review2 Review3 Review4 Review5 Review6 Review7 Review8 Review9 Year+]]"/>

</$button>
</$list>
~~~

But for some reason it doesn't work when I try to combine the list filter widget and FieldMangler widgets to add a tag like this:

~~~
<$list filter="[[{{!!title}}]]+[tag[Current]]">

<$fieldmangler>
<$button message="tm-remove-tag" param="Current"></$button>
</$fieldmangler>

</$list>

~~~

It seems list filter and FieldMangler don't play well together but I don't know of another way to make the button disappear once the tag is removed. Also, for some reason the filter syntax "[[{{!!title}}]]+[tag[Current]]" or "[[{{!!title}}]tag[Current]]" doesn't work even though it seems to work fine on the example above. 

Thanks in advance!

Andrew Whiting

unread,
Sep 8, 2016, 4:35:37 PM9/8/16
to TiddlyWiki
What's the syntax you guys use to block out code? I'm obviously not a programmer...

Zaphod Beeblebrox

unread,
Sep 8, 2016, 6:28:11 PM9/8/16
to tiddl...@googlegroups.com
Sorry I can't help with your button problem, but I can offer a little assistance with blocking out code:

Enclose whatever you don't want to show/run/whatever within "<!--" and "-->"

Some Code
Some More Code
<!--
Super-Secret Code That No One Should See :P
-->
And Even More Code
<!-- This is a remark that I put here to remind me that I need to add more code to this code... -->
Would You Believe There's Additional Code Down Here?


It can be written either inline or block-style, just be sure to leave one space on each end, between the tag and your code.

--Zaphod

Mark S.

unread,
Sep 8, 2016, 7:21:27 PM9/8/16
to TiddlyWiki
I'm unclear what you're trying to accomplish, but this code works:

<$list filter="[is[current]tag[Current]]">

<$fieldmangler>
<$button message="tm-remove-tag" param="Current">REMOVE IT</$button>
</$fieldmangler>

</$list>

If you really needed to reference a field inside of your filter, the syntax is "operator{!!field}" . I also added text to the button so there is something visible to push.

HTH
Mark

Andrew Whiting

unread,
Sep 11, 2016, 10:21:11 AM9/11/16
to TiddlyWiki
Hi Mark,

Sorry I was unclear. What you gave me was exactly what I needed though! Thank you!

Andrew

Andrew Whiting

unread,
Sep 11, 2016, 10:21:42 AM9/11/16
to TiddlyWiki
Good to know. Thank you!
Reply all
Reply to author
Forward
0 new messages