Thanks Jed. I'll work with that. For the second question, I mean that I
would like a single template where I don't need to make any modifications
that uses the current tiddler as the tag and makes a checkboxed list. That
way all I need to do in any given tiddler is just call that template and i
magically have a checkboxed list of all tiddlers that are tagged with that
tiddler.
Sorry if I'm not stating that as clearly as I should
On Wednesday, May 20, 2015 at 9:37:40 AM UTC+8, Jed Carty wrote:
>
> For the first one:
>
> Looking at the code I gave you now I am a bit embarrassed. The checkbox
> state has no persistent storage, so anytime the toc is refreshed the state
> would be reset like you are seeing. This shouldn't have that problem. It
> may have other problems I haven't seen. Also it is only adding one line to
> the default toc macro:
>
> \define
> my-toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter)
> <$set name="toc-state" value=<<qualify
> "$:/state/toc/$tag$-$(currentTiddler)$">>>
> <$set name="toc-item-class" filter="""$itemClassFilter$"""
> value="toc-item-selected" emptyValue="toc-item">
> <li class=<<toc-item-class>>>
> <$checkbox tiddler="""$(currentTiddler)$""" tag='done'/>
> <$link>
> <$list filter="[all[current]tagging[]limit[1]]" variable="ignore"
> emptyMessage="<$button
> class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
> <$reveal type="nomatch" state=<<toc-state>> text="open">
> <$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
> {{$:/core/images/right-arrow}}
> </$button>
> </$reveal>
> <$reveal type="match" state=<<toc-state>> text="open">
> <$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
> {{$:/core/images/down-arrow}}
> </$button>
> </$reveal>
> </$list>
> <<toc-caption>>
> </$link>
> <$reveal type="match" state=<<toc-state>> text="open">
> <$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>>
> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
> </$reveal>
> </li>
> </$set>
> </$set>
> \end
>
> This will give the the tag 'done' when the box is checked. If you don't
> want to put the tag on the tiddler itself but still have a persistent state
> replace """$(currentTiddler)$""" with
> <<toc-state>>
> And you can of course change the checkbox to use a field or another tag.
>
> I am not sure exactly what you are asking for the second one. Do you want
> a checklist that when each item is checked it gets tagged with the current
> tiddler?
> If so you could make a macro like this (this also adds the answer to the
> third part):
>
> \define makeChecklist(filter)
> <$set name='taggingTiddler' value=<<currentTiddler>>>
> <$list filter='$filter$'>
> <$checkbox tiddler=<<currentTiddler>> tag=<<taggingTiddler>>><$view
> field='caption'><$view field='title'/></$view></$checkbox><br>
> </$list>
> </$set>
> \end
>
> Put this in a tiddler, tag that tiddler with $:/tags/Macro and then in any
> tiddler you put <<makeChecklist '[tag[something]]'>> (replace
> [tag[something]] with the filter you want to use to make the checklist) and
> it will create the list in that tiddler.
> If you want to click on the caption/title and open the tiddler instead of
> toggling the checkbox than you would replace the checkbox widget with this:
> <$checkbox tiddler=<<currentTiddler>> tag=<<taggingTiddler>>/><$link
> to=<<currentTiddler>>><$view field='caption'><$view
> field='title'/></$view></$link><br>
>
> For the third one the answer is easy enough:
>
> <$list filter=<<whateverfilteryouusetomakeyourlist>>>
> <$checkbox tiddler='somestatetiddler' field=somefield checked=checkedvalue
> unchecked=uncheckedvalue><$view field=caption><$view
> field='title'/></$view></$checkbox>
> </$list>
>
> or you can have the checkbox linked to a tag or whatever. The <$view
> field='caption'><$view field='title'/></$view> is the important part. If
> what you tell a view widget to display exists than anything between <$view>
> and </$view> is ignored, but if what you tell it to display doesn't exist
> whatever is inside the tags is displayed instead.
>
> Like I said, I am a bit embarrassed that I missed that problem before.
> Sorry about that.
>
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/158bc21b-11b2-472b-99fe-1695a97dbb4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.