On Monday, May 31, 2021 at 11:49:48 AM UTC+2 PMario wrote:
If you search for "toggle" at tiddlywiki.com you'll find:
https://tiddlywiki.com/#toggle%20Operator%20(Examples):%5B%5Btoggle%20Operator%20(Examples)%5D%5D%20%5B%5Btoggle%20Operator%5D%5D
The examples already contain the "action-listops" ...
\define toggle-urgent()
> <$action-listops $tiddler={{!!title}} $field="tags"
> $subfilter="+[toggle[urgent]]" />
> \end
>
I did modify the $fields="tags" and
changed the $subfilter="+[toggle[urgent]]" .. so it toggles between 1 value
There's the action-listops docs
<https://tiddlywiki.com/#ActionListopsWidget>. It has a lot of
possibilities, but also a lot of examples to play with.
> <$button actions=<<toggle-urgent>> >
>
This is a relatively common usage of the button-widget
<https://tiddlywiki.com/#ButtonWidget>. Using actions=<<macro-name>> will
clean up the code, if you need to call more than 1 action. ... It is "best
practice".
> <$list
> filter="[all[current]tag[urgent]then[★]else[☆]]"><<currentTiddler>></$list>
>
all[current] ... will return the currentTiddler variable.
tag[urgent] ... tests if the "urgent" tag is set
then[★] ... will set the currentTiddler variable of the list-body to
the "filled star" character
else[☆] ... will set the currentTiddler variable of the list-body to
the "empty star" character
<<currentTiddler>> ... will show the star, depending on tag - then / else
... see: currentTiddler
<https://tiddlywiki.com/#Current%20Tiddler:%5B%5BCurrent%20Tiddler%5D%5D%20%5B%5BcurrentTiddler%20Variable%5D%5D%20%5B%5BcurrentTiddler%20Variable%20(Examples)%5D%5D>
variable
> </$button>
>
> You can call it with {{|| my-toggle-template}}
>
Uses the transcluded tiddler as a template. see more info here
<https://tiddlywiki.com/#Transclusion:Transclusion%20%5B%5BTransclusion%20with%20Templates%5D%5D%20TemplateTiddlers>.
> If you want to hide the button use: <$button *class="tw-btn-invisible"*
> actions=<<toggle-urgent>> > ... you will only get the star.
>
Just test it ;)
hope that helps
-mario
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/3af218b8-38db-432c-a43b-893262f99499n%40googlegroups.com.