Utilizing Reveal Widget in Templates

74 views
Skip to first unread message

mmiller

unread,
Feb 3, 2021, 1:06:05 PM2/3/21
to TiddlyWiki

Hello,

First time posting to this group, but I have used the group to troubleshoot in the past. I'm a bit of  novice, but normally am able to get Tiddlywiki to do what I want with little issue. I'm very sure there is a simple solution to my problem, but I am just entirely missing it.

I am utilizing the reveal widget through a template (see below). This template is being used by many tiddlers. The details widget works no problem and the list works fine; however, when I toggle the button for the reveal widget it is universally toggling every tiddler utilizing the template. Clearly I need to make the reveal button only toggle for the specific tiddler, but I can't for the life of me figure out how to target the button to one tiddler at a time. Any assistance is appreciated!

Template:

<$details  summary="Explained/Definition" >
{{!!definition}}
</$details>

---<br>

<$reveal type="nomatch" state="$:/state/SampleReveal2" text="show">
<$button set="$:/state/SampleReveal2" setTo="show" class="NestRevealButton">View Goals
</$button>
</$reveal>

<$reveal type="match" state="$:/state/SampleReveal2" text="show">
<$button set="$:/state/SampleReveal2" setTo="hide" class="NestRevealButton">Hide Goals</$button>

<$scrollable class='tc-scrollable-browse'>
 <$list filter='[tag<currentTiddler>level[GOAL]sort[title]]'> <$link><$view field='title'/></$link><br> <$view field='language'/> <br>     </$list>
</$scrollable>

</$reveal>


Eric Shulman

unread,
Feb 3, 2021, 1:27:21 PM2/3/21
to TiddlyWiki
On Wednesday, February 3, 2021 at 10:06:05 AM UTC-8 mmiller wrote:
I am utilizing the reveal widget through a template (see below). This template is being used by many tiddlers.
...when I toggle the button for the reveal widget it is universally toggling every tiddler utilizing the template.
<$reveal type="nomatch" state="$:/state/SampleReveal2" text="show">
<$button set="$:/state/SampleReveal2" setTo="show" class="NestRevealButton">View Goals
</$button>
</$reveal>

<$reveal type="match" state="$:/state/SampleReveal2" text="show">
<$button set="$:/state/SampleReveal2" setTo="hide" class="NestRevealButton">Hide Goals</$button>
<$scrollable class='tc-scrollable-browse'>
 <$list filter='[tag<currentTiddler>level[GOAL]sort[title]]'> <$link><$view field='title'/></$link><br> <$view field='language'/> <br>     </$list>
</$scrollable>
</$reveal>

You need to use the <<qualify>> macro to generate a unique state tiddler title for each reveal.

Thus, instead of using "$:/state/SampleReveal2", you would use <<qualify "$:/state/SampleReveal2">>, like this:
<$reveal type="nomatch" state=<<qualify "$:/state/SampleReveal2">> text="show">
<$button set=<<qualify "$:/state/SampleReveal2">> setTo="show" class="NestRevealButton">View Goals
</$button>
</$reveal>

<$reveal type="match" state=<<qualify "$:/state/SampleReveal2">> text="show">
<$button set=<<qualify "$:/state/SampleReveal2">> setTo="hide" class="NestRevealButton">Hide Goals</$button>
<$scrollable class='tc-scrollable-browse'>
 <$list filter='[tag<currentTiddler>level[GOAL]sort[title]]'> <$link><$view field='title'/></$link><br> <$view field='language'/> <br>     </$list>
</$scrollable>
</$reveal>

enjoy,
-e

mmiller

unread,
Feb 3, 2021, 1:41:33 PM2/3/21
to TiddlyWiki
Eric,

I'll have to read more to understand exactly why, but that did it! Thanks for the help!

- Mark
Reply all
Reply to author
Forward
0 new messages