On Wednesday, July 22, 2020 at 10:19:08 PM UTC-7, Bob Jansen wrote:
>
> I have a tiddlywiki file with 170 'pages' of information. Each tiddler 
> corresponds to a physical page in a book. I would like a button to allow 
> the user to 'turn the page', next or previous, without having to type its 
> title into the search bar. Pages have a title of 'Page 001', 'Page 002', 
> etc.
>
>
> http://cultconv.com/English/Conversations/MacQueen_Mary/TiddlyWiki/index.html
>

OK... here you go...

1) Create a tiddler named "PageTurner"
2) Give it a tag of "$:/tags/ViewTemplate"
3) Create a field named "list-after" with a value of 
"$:/core/ui/ViewTemplate/title"
4) Enter the following content and save the tiddler
<$list filter="[<currentTiddler>tag[Pages]]">
<div style="float:right;">
   <$vars prev={{{ [tag[Pages]sort[]before<currentTiddler>] }}}>
   <$vars next={{{ [tag[Pages]sort[]after<currentTiddler>] }}}>
   <$reveal default=<<prev>> type="nomatch" text="">
   <$button tooltip=<<prev>>> {{$:/core/images/chevron-left}}
      <$action-sendmessage $message="tm-close-tiddler" param=<
<currentTiddler>> />
      <$action-navigate $to=<<prev>>/>
   </$button>
   </$reveal>
   <$reveal default=<<next>> type="nomatch" text="">
   <$button tooltip=<<next>>> {{$:/core/images/chevron-right}}
      <$action-sendmessage $message="tm-close-tiddler" param=<
<currentTiddler>> />
      <$action-navigate $to=<<next>>/>
   </$button>
   </$reveal>
   </$vars>
   </$vars>
</div>
</$list>

What it does:
1) Tagging it with $:/tags/ViewTemplate automatically adds the PageTurner 
content to every tiddler
2) Giving it a "list-after" field with value 
"$:/core/ui/ViewTemplate/title" places the PageTurner content after the 
tiddler title

Then, the PageTurner content does the following:
3) The $list widget checks to see if the current tiddler is tagged with 
"Pages".  This limits the output so it will only appear on tiddlers with 
that tag.
4) <div style="float:right;"> puts the content on the right side of the 
tiddler so it appears just below the regular tiddler toolbar.
5) The two $vars get the list of all tiddlers tagged with "Pages" and finds 
the one before and after the currentTiddler.
6) The first $reveal ensures that the "previous" button will only appear if 
there is a previous tiddler (i.e., not on the first page)
7) The first $button shows a "chevron-left" (double arrow), and a tooltip 
with the title of the previous tiddler.
8) When the "previous" $button is clicked, it closes the currentTiddler, 
and navigates to the previous tiddler.
9) The second $reveal ensures that the "next" button will only appear if 
there is a next tiddler (i.e, not on the last page)
10 The second $button shows a "chevron-right" (double arrow), and a tooltip 
with the title of the next tiddler.
11) When the "next" $button is clicked, it closes the currentTiddler, and 
navigates to the next tiddler.

That's it.  I've tested this on the TiddlyWiki that you posted online, and 
it works nicely.

Let me know how it goes...

enjoy,
-e

-- 
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/c9aaad99-3a06-444b-a7db-0c9c3c3d5694o%40googlegroups.com.

Reply via email to