Tweaking reveal states and button states

349 views
Skip to first unread message

David Gifford

unread,
Aug 16, 2014, 10:21:23 AM8/16/14
to tiddl...@googlegroups.com
Hi everyone,

This morning I was playing around with a cool slider idea (see below). But I need your help.

The idea is that each TOC tiddler would have a list showing links to all tiddlers tagged with the current tiddler and also tagged with $:/TOC. For each tiddler in the list, you would see a link to the tiddler title, and an arrow button, which, when clicked, would transclude that tiddler's contents, which would consist only of the same slider. [actual content would be viewed in a separate viewtemplate element, so transcluding the text field would not transclude the note content]. Each list would be wrapped in indent code so that each successive level would be slightly indented below its parent.

I got most of it to come together, and it looks nice. My problem is that the slider states are all connected to the current tiddler rather than operating independently. I thought that by using a macro (see below) and nesting it inside the list, it would grab the title field of the list item. But alas, it appears they all grab the title of the current tiddler. Is there a way to tweak either the list or the macro or both so that the reveal state and button states grab the title of the tiddler in which they are each respectively found? I think you will see what I am getting at if you see an example:

http://www.giffmex.org/experiments/multileveltoctest.html#Old%20Testament

Here is the slider:

<<giffTOCmacro>>
<span class="indent1"><$list filter="[is[current]tagging[$:/TOC]!tag[$:/Note]sort[title]]">

<$link><$view field="title"/></$link> <$reveal type="nomatch" state="$:/state/$title$" text="show"><$button class="whitebutton" set="$:/state/$title$" setTo="show">&#9660;</$button></$reveal><$reveal type="match" state="$:/state/$title$" text="show"><$button class="whitebutton" set="$:/state/$title$" setTo="hide">&#9650;</$button>

<$transclude/>

</$reveal>

And here is giffTOCmacro:

\define giffTOCmacro (title:<$view field="title"/>)
$title$
\end

</$list></span>

And here is the relevant CSS:

.whitebutton {background:white;border:none;color:#ccc;}
html body.tw-body .indent1 {margin-left:1.5em;display:block;}

David Gifford

unread,
Aug 16, 2014, 10:41:33 AM8/16/14
to tiddl...@googlegroups.com
Or if I turned it into an ordered list, could there be something roughly like this?

set="$:/state/$title of tiddler in which the list is found$/# in present ordered list"

David Gifford

unread,
Aug 16, 2014, 4:46:18 PM8/16/14
to tiddl...@googlegroups.com
Here is a more refined version, but with the same problem described in the original post

http://www.giffmex.org/experiments/Philosophy.html

David Gifford

unread,
Aug 16, 2014, 4:50:39 PM8/16/14
to tiddl...@googlegroups.com
Forgot to mention that in this file you can already use the newhere buttons at the top of the tiddlers to create subindexes, notes and notes with images.

PMario

unread,
Aug 17, 2014, 3:21:38 AM8/17/14
to tiddl...@googlegroups.com
Hi Dave,

Cool stuff is going on :)

Did you analyse the http://tiddlywiki.com/#TableOfContents tiddler?

The widget that you want to use is <<qualify ...>> it creates uniqe state tiddlers.
If you have a closer look at Jeremy's TOC, I think you'll find out.

The difference is, that your list is created dynamically, while the TW TOC is hard coded.

-mario

David Gifford

unread,
Aug 17, 2014, 7:58:00 AM8/17/14
to tiddl...@googlegroups.com
Hey Mario, thanks for the reply.

I just re-added the "qualify" bit in the places where it belongs. I think I had it in there to begin with. See my revised http://giffmex.org/experiments/Philosophy.html#

The benefit is that I can now open each level of the generated outline separately from each other. The drawback is that the list items themselves are connected. Clicking on any item of level two of the outline opens ALL the items on level two of the outline. Same for any level. I wish there were a way to make each list item independent by grabbing the title of that list item and using it to change the state of only that list item...

At the moment it is creating state tiddlers called $:/state/toc/$caption$-{-1412631655}. I want the macro to insert the tiddler name when the list item is generated, so that what is created are state tiddlers like $:/state/toc/Defining$20philosophy

Any way to do this? Do I just have the macro caption wrong? And...would that create way too many state tiddlers at once? Would I be taxing TiddlyWiki by doing that?

Blessings,

David Gifford

unread,
Aug 18, 2014, 1:53:06 PM8/18/14
to tiddl...@googlegroups.com
Leave it to me to come with ideas on Saturday morning...hey guys now that it is Monday, maybe some of you could look at this question of mine in my previous post on this thread...if I get it answered, at least there will be a way to create tree menus in TW5, something similar to tagglytagging...Blessings to you all

Dave

Jeremy Ruston

unread,
Aug 18, 2014, 4:32:36 PM8/18/14
to TiddlyWiki
Hi Dave

I've added a couple of simple table of contents macro to the core that show how to solve the problem you've encountered. See the `toc-expandable` macro:


The trick is to use an inner macro that includes the title of the current tiddler into the qualified state tiddler root. Without the inner macro the "currentTiddler" variable would inherit the value from the caller of the outer `toc-expandable` macro.

Best wishes

Jeremy





On Mon, Aug 18, 2014 at 6:53 PM, David Gifford <dgif...@crcna.org> wrote:
Leave it to me to come with ideas on Saturday morning...hey guys now that it is Monday, maybe some of you could look at this question of mine in my previous post on this thread...if I get it answered, at least there will be a way to create tree menus in TW5, something similar to tagglytagging...Blessings to you all

Dave

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

David Gifford

unread,
Aug 18, 2014, 6:50:11 PM8/18/14
to tiddl...@googlegroups.com
Wow, great, Jeremy! Let me know when you add it to http://tw5test.tiddlyspot.com/ so I can give it a try.


Dave


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/-glmJ7009HM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
David Gifford
Christian Reformed World Missions, Mexico City

David Gifford

unread,
Aug 18, 2014, 9:08:51 PM8/18/14
to tiddl...@googlegroups.com
​Hi Jeremy, first of all, thanks for the expandable macro. Very nice! I hope late this week to use it to organize the first draft of a tutorial for you.

Second, I now see how to properly view in Github and copy to my TW5. Having fun playing with the expandable after adding some CSS.

Third, would there be a way for me to have an expandable macro in every tiddler, that appears if there are any tiddlers tagged with that tiddler's title? That way no matter what tiddler I am in, I can still tunnel down. I will experiment in a moment, but I have a feeling I won't see how to do it.

Blessings,​

David Gifford

unread,
Aug 18, 2014, 9:28:03 PM8/18/14
to tiddl...@googlegroups.com
Well, that was easy, you have it right in the macro tiddler: <$macrocall $name="toc-expandable" tag=<<currentTiddler>>/>

David Gifford

unread,
Aug 19, 2014, 7:16:18 AM8/19/14
to tiddl...@googlegroups.com
Hey Jeremy

Here are the results of my experimenting with your toc macro, slightly tweaked and with different CSS

http://giffmex.org/experiments/toctemplate.html#StartHere

Sorry I can't be at the hangouts this semester, I have classes at the seminary on Tuesdays. Blessings! And thanks again for yet another awesome toll for TiddlyWiki.

Dave


On Monday, August 18, 2014 8:28:03 PM UTC-5, David Gifford wrote:
Well, that was easy, you have it right in the macro tiddler: <$macrocall $name="toc-expandable" tag=<<currentTiddler>>/>
On Mon, Aug 18, 2014 at 8:08 PM, David Gifford <dgif...@crcna.org> wrote:
​Hi Jeremy, first of all, thanks for the expandable macro. Very nice! I hope late this week to use it to organize the first draft of a tutorial for you.

Second, I now see how to properly view in Github and copy to my TW5. Having fun playing with the expandable after adding some CSS.

Third, would there be a way for me to have an expandable macro in every tiddler, that appears if there are any tiddlers tagged with that tiddler's title? That way no matter what tiddler I am in, I can still tunnel down. I will experiment in a moment, but I have a feeling I won't see how to do it.

Blessings,​
On Mon, Aug 18, 2014 at 5:50 PM, David Gifford <dgif...@crcna.org> wrote:
Wow, great, Jeremy! Let me know when you add it to http://tw5test.tiddlyspot.com/ so I can give it a try.


Dave
On Mon, Aug 18, 2014 at 3:32 PM, Jeremy Ruston <jeremy...@gmail.com> wrote:
Hi Dave

I've added a couple of simple table of contents macro to the core that show how to solve the problem you've encountered. See the `toc-expandable` macro:


The trick is to use an inner macro that includes the title of the current tiddler into the qualified state tiddler root. Without the inner macro the "currentTiddler" variable would inherit the value from the caller of the outer `toc-expandable` macro.

Best wishes

Jeremy



On Mon, Aug 18, 2014 at 6:53 PM, David Gifford <dgif...@crcna.org> wrote:
Leave it to me to come with ideas on Saturday morning...hey guys now that it is Monday, maybe some of you could look at this question of mine in my previous post on this thread...if I get it answered, at least there will be a way to create tree menus in TW5, something similar to tagglytagging...Blessings to you all

Dave

--
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 tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/-glmJ7009HM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
--
David Gifford
Christian Reformed World Missions, Mexico City



--
David Gifford
Christian Reformed World Missions, Mexico City

Jeremy Ruston

unread,
Aug 19, 2014, 7:31:44 AM8/19/14
to TiddlyWiki
Hi Dave

Great, glad it's making sense.

I've just added a variant of the toc macro that selectively displays the expand/collapse buttons according to whether a node actually has any children:


It needs more careful styling to look decent, of course.

Best wishes

Jeremy



To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

David Gifford

unread,
Aug 19, 2014, 8:32:24 AM8/19/14
to tiddl...@googlegroups.com
Ah, that is nice to be able to distinguish between them. The visual issue is that the items with no children stay flush left, so they are no longer aligned correctly with the ones that do have children that move right when the icon is added.

Dave


To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--

David Gifford

unread,
Aug 19, 2014, 8:37:57 AM8/19/14
to tiddl...@googlegroups.com
what about a bold plus sign for closed tiddlers with children, and bold minus signs for open tiddlers with children, and for tiddlers with no children?


To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages