Jed:
I came across this post while searching for a solution to my current
situation.
I have a TW5 wiki that contains my book collection. I have tiddlers for
each author, and tiddlers for each book by that author. I have used the toc
macro: toc-selective-expandable to create my nested listing. What I am
wanting to do is add a checkbox to each book in my list, so that when I
have completed reading it I can check it off,
give it a status of "Read" and strike through the title.
Your code gave me a start but since I am not a programmer I do not
understand how to get a checkbox next to each book title. This code only
places a checkbox next to
the authors name.
Example of what I am trying to achieve:
> Douglas Preston & Lincoln Child
[ ] The Relic
[ ] Riptide
> James Rollins
[ ] Ice Hunt
[ ] Excavation
What I have today:
[ ] > Douglas Preston & Lincoln Child
The Relic
Riptide
[ ] > James Rollins
Ice Hunt
Excavation
How would your code be modified to do what I want?
Thank you in advance for your time.
Charles
On Tuesday, May 19, 2015 at 9:37:40 PM UTC-4, 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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/04f9defa-4dc0-4c0a-9306-14f9aa72f2d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.