Automatically Close All Tiddlers if User Specific Landing Page is Opened

Hello,
I have nearby the same requirement to solve, but unfortunately not 100%.

I want to call the close all routine as it is available in open tab at the beginning ot some of my tiddlers.

This is not cleaning the list of tiddlers listed in open

<$action-sendmessage $message="tm-close-all-tiddlers"/>

A lot of Text here

Is there another way available?

Just transclude or use the close all button ? {{$:/core/ui/Buttons/close-all}}

Or in a list prefix each item with {{||$:/core/ui/Buttons/close}} to close the current tiddler.

Normaly closing just removes the tiddler(s) from $:/StoryList!!list

But do you meen something else from this thread?

Hi TW_Jones,

the use case is the following. My family and me are using the sme wiki on the same device. We have a table of content with all of our names in there and if a user is changing the user call at first his/her landing page from the table of contents.
In all of these landing pages we want to call the “close all” function to clean the open section from the content of the user befeore.

How to start the button without pressing the button, more automatically if the tiddler is called?

<$action-navigate $to="$:/core/ui/Buttons/close-all"/>

Hi Stefan,
I did move the posts to it’s own thread, because I think it’s different enough to be split.

Action-widgets can only be activated by user interaction. So you need a button somewhere. IMO it may be possible, that your “special table of contents” contains such a configuration.

I think it should be possible to use the linkcatcher-widget. So if you cover your TOC inside the linkcatcher it will intercept navigate-to and can additionally trigger some actions and then navigate to the landing page.

If that’s not enough info let us know.

If you open this tiddler and look at the message or actions it triggers you just need to use something to trigger the same actions. If you make a button to select a user, such as a select widget you can use its actions to make the changes you want.

  • I would need to research it further but you could;
    • Save the current story in a tiddler named for the first user
    • Restore or reset the story for the new user
    • Open the tiddlers in the story if not already

Are you sharing one single file wiki? Perhaps it would be better to use tiddlywiki bob? Other wise you could build this switching behaviour into the single file wiki so users can only access it if the last user “logged out”.

I was thinking about something like this:

title: TOC

\define levelPlayfield()
<$action-sendmessage $message="tm-close-all-tiddlers"/>
<$action-navigate $to=<<navigateTo>> />
\end

<$linkcatcher actions=<<levelPlayfield>> >
<div class="tc-table-of-contents">
<<toc "Landing">>
</div>
</$linkcatcher>

and 3 tiddlers Mom, Dad, Child-1 tagged: Landing

close-all-then-navigate-linkcatcher.json (731 Bytes)

Link to the docs for the widgets used.

Have fun!
mario

Hi pmario,

I knee down full of respect about your solution.

After playing aroud with the code, I (maybe) will use this also in other wikis in the future. Therfore and also for other user having the same idea here the code with some comments inside:

<!-- Replace this code with the code inside TableOfContents Tiddler -->

<!-- source by pmario from https://talk.tiddlywiki.org/t/automatically-close-all-tiddlers-if-user-specific-landing-page-is-opened/7214/5 -->

\define levelPlayfield()
<$action-sendmessage $message="tm-close-all-tiddlers"/>
<$action-navigate $to=<<navigateTo>> />
\end

<$linkcatcher actions=<<levelPlayfield>> >
<div class="tc-table-of-contents">
<<toc-selective-expandable "TableOfContents">>  <!-- Change TableOfContents to another tag (e.g. Landing) to define the root -->
</div>
</$linkcatcher>

Thx
Stefan

1 Like

i made a read-only mode that activates when a specific tiddler is opened, and i used the (SCARY) trigger widget which can call actions whenever it is loaded. it was very easy to make actions that activate when the tiddler is opened (from any link etc). figured i’d put this here in case anyone is looking for a drag-and-drop solution.

hihi, … When I did read the OP, I actually did think about the trigger-plugin. But then I did see that there is user interaction with the TOC. So the link-catcher widget came into my mind. …

The trigger-widget is very powerful, but while developing it’s very important to have enough backups. That’s why I always use a “scary” disclaimer :wink:

While developing it’s possible to run into endless loops, that could “brick” the wiki. eg: If a trigger opens a tiddler which also contains a trigger, that causes a refresh on the first one. … :bomb: So it’s always good to have backups.