[TW5] Trick: inverting the tasks list system (without need of task tiddlers)

393 views
Skip to first unread message

Alberto Molina

unread,
Jul 29, 2014, 6:49:51 PM7/29/14
to tiddl...@googlegroups.com
Hi everybody,

The TaskManagementExample in tw.com [1] shows a list of task tiddlers with checkboxes that can tag them as done. That means that, to create a list of tasks, you previously need to create the corresponding tiddlers and tag them as "task" and, then, put a <$list filter="something"> to see the tasks list.

I needed a simpler way to create task lists without creating tiddlers. My idea was to just start writing a list of things displayed as tasks. And the solution I found is using a "ToDo" tiddler and a "done" tiddler, and tag them with the task, instead of doing the other "normal" way around. And the list is created  through a transclusion template, like that:

{{This is a task that is not an existing tiddler||task}}
{{This is another one||task}}
{{And a third||task}}

The name of the tasks are not tiddler titles for there's no corresponding tiddlers. The only required tiddlers are:
  • task
  • ToDo
  • done

The tiddler "task" contains the following code (I would rather prefer using <$reveal> instead of the combination <$set><$list><$tiddler> but filters doesn't seem to work with <$reveal>):

\define addThis() [[$(new)$]] $(old)$

<$set name="current" value=<<currentTiddler>> >

   
<$list filter="[[ToDo]!tag{!!title}]">
       
<$tiddler tiddler=<<current>> >
           
<$set name="old" value={{ToDo!!tags}}>
               
<$set name="new" value={{!!title}}>
                   
<$button set="ToDo!!tags" setTo=<<addThis>> >{{!!title}}</$button>
               
</$set>
            </
$set>
       
</$tiddler>
    </
$list>

   
<$list filter="[[ToDo]tag{!!title}] +[[done]!tag{!!title}]">
       
<$tiddler tiddler=<<current>> >
           
<$checkbox tiddler="done" tag={{!!title}}>{{!!title}}</$checkbox>
       
</$tiddler>
    </
$list>

   
<$list filter="[[ToDo]tag{!!title}] +[[done]tag{!!title}]">
       
<$tiddler tiddler=<<current>> >
           
<$checkbox tiddler="done" tag={{!!title}}>~~{{!!title}}~~</$checkbox>
       
</$tiddler>
    </
$list>

</$set>


When transcluded, the task appears as a button. On click, it tags the tiddler "ToDo" with that task and displays the text of the task with a checkbox. On check, the tiddler "done" is tagged with the task and the text of the task is ~~(I don't remenber the word for that :-)~~

Hope this is helpful.

Alberto

[1] http://tiddlywiki.com/#:TaskManagementExample

Alberto Molina

unread,
Jul 29, 2014, 7:05:21 PM7/29/14
to tiddl...@googlegroups.com
A last minute bug correction and a screenshot.



The tiddler "task" contains the following code (I would rather prefer using <$reveal> instead of the combination <$set><$list><$tiddler> but filters doesn't seem to work with <$reveal>):
\define addThis() [[$(new)$]] $(old)$

<$set name="current" value=<<currentTiddler>> >

   
<$list filter="[[ToDo]!tag{!!title}]">
       
<$tiddler tiddler=<<current>> >
           
<$set name="old" value={{ToDo!!tags}}>
               
<$set name="new" value={{!!title}}>
                   
<$button set="ToDo!!tags" setTo=<<addThis>> >{{!!title}}</$button>
               
</$set>
            </
$set>
       
</$tiddler>
    </
$list>

   
<$list filter="[[ToDo]tag{!!title}]">

       
<$tiddler tiddler=<<current>> >
           
<$list filter="[[done]!tag{!!title}]">

                 
<$tiddler tiddler=<<current>> >
                   
<$checkbox tiddler="done" tag={{!!title}}>{{!!title}}</$checkbox>
               
</$tiddler>
            </
$list>
       
</$tiddler>
    </
$list>

   
<$list filter="[[ToDo]tag{!!title}] +[[done]tag{!!title}]">
       
<$tiddler tiddler=<<current>> >
           
<$checkbox tiddler="done" tag={{!!title}}>~~{{!!title}}~~</$checkbox>
       
</$tiddler>
    </
$list>

</$set>


 Alberto

Capture du 2014-07-30 01:01:06.png

Mark Brown

unread,
Jul 30, 2014, 4:12:18 AM7/30/14
to tiddl...@googlegroups.com

Brilliant!

HansWobbe

unread,
Jul 30, 2014, 10:09:45 AM7/30/14
to tiddl...@googlegroups.com
Very useful and quite innovative!  Thanks for sharing.


On Tuesday, July 29, 2014 6:49:51 PM UTC-4, Alberto Molina wrote:
Hi everybody,

...

Albert

unread,
Jul 30, 2014, 1:14:33 PM7/30/14
to tiddl...@googlegroups.com
Thank you very much Alberto, it seems you've reached a spectacular knowledge of TW mechanisms (specially TW5 for Scholars is an amazing TW).

I'm also looking for a solution for simplet in-line task creation without prior task tiddler defintion. I find your way very clever, the only problem is that you can end up with a very long list of tags... I'll give it a thought though!

Thanks again,
Albert

Alberto Molina

unread,
Jul 31, 2014, 7:38:44 AM7/31/14
to tiddl...@googlegroups.com
@Mark, @Hans, @Albert: Thanks for your kind words, I'm glad you like it.

> the only problem is that you can end up with a very long list of tags... 
Yes, but the other way around you can end up with a very long list of tiddlers… I don't know what's better/worse.

------------

Now I face another problem (« And more difficult still! »)

My trick uses a "pseudo tiddler" (like: "catch the moon") that is taken as the "current tiddler" by the code inside my "template tiddler" ("task"):

{{catch the moon||task}}

And {{catch the moon||task}} is itself inside a "real tiddler" called, for instance, "HowToSeduceAGirl". With the transclusion, the current tiddler changes from "
HowToSeduceAGirl" to "catch the moon", and the former one is lost in transclusion =)

What I would like to achieve is not to loose the "HowToSeduceAGirl" title. In other words, I would like my template tiddler knew that "catch the moon" is a task of "HowToSeduceAGirl".

Why? Because I want different ToDo lists. For example, one for each course I'm teaching (about languages and philosophy, not seducing girls :) . And each list would be inside a tab in my TW for Scholars. Thus, I need my mechanism to write "catch the moon" as tag of the ToDo list (transcluded in a tab) of my current course.

One (bad) solution could be like that:

<$set name="containingTiddler" value=<<currentTiddler>> > {{catch the moon||task}} {{buy flowers||task}} </$set>

But even if it works (I guess), its not a good one because it breaks the simplicity of just writ
ing down the list of tasks. 

So, any better idea is welcome.

Alberto

Matabele

unread,
Jul 31, 2014, 11:47:25 AM7/31/14
to tiddl...@googlegroups.com
Hi Alberto

I would suggest using entirely functional and recursive code structures -- simply writing down a list of tasks just isn't going to make the grade -- great analogies :-)

regards

Jeremy Ruston

unread,
Aug 1, 2014, 9:38:43 AM8/1/14
to TiddlyWiki
Hi Danielo

There is a standard variable "storyTiddler" that is set by the default viewtemplate to the title of the tiddler in the story; you should be able to use it to avoid your "containingTiddler" variable.

Also be aware that the {{transclusion}} syntax is actually a shorthand for a tiddler widget containing a transclude widget. You can use the transclude widget on it's own to transclude a tiddler without changing the current tiddler.

Best wishes

Jeremy


--
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

Alberto Molina

unread,
Aug 1, 2014, 11:16:25 AM8/1/14
to tiddl...@googlegroups.com, jeremy...@gmail.com
Hi Jeremy,

Thanks for your answer!

There is a standard variable "storyTiddler" that is set by the default viewtemplate to the title of the tiddler in the story; you should be able to use it to avoid your "containingTiddler" variable.

I think it is what I was looking for. 
 
Also be aware that the {{transclusion}} syntax is actually a shorthand for a tiddler widget containing a transclude widget. You can use the transclude widget on it's own to transclude a tiddler without changing the current tiddler.

In that case I need the {{transclusion}} syntax because it is a shorthand, but it is good to remember that its behaviour is not exactly the same as the transclude widget.

Best wishes,

Alberto

Alberto Molina

unread,
Aug 3, 2014, 3:35:15 AM8/3/14
to tiddl...@googlegroups.com, jeremy...@gmail.com
Hi all

Now I face another problem (« And more difficult still! »)

SOLVED! 
 
There is a standard variable "storyTiddler" that is set by the default viewtemplate to the title of the tiddler in the story; you should be able to use it to avoid your "containingTiddler" variable.

I think it is what I was looking for. 

Indeed, it was what I was looking for. And I learned that I can just use inside macros variables like <<currentTiddler>> and <<storyTiddler>> without even declaring them thanks to the syntax $(storyTiddler)$. It opens to me a whole new world of opportunities!!!

AND THIS IS MY SOLUTION:

(The following is the content of the tiddler "task")

\define addThis() [[$(new)$]] $(old)$

\define tasks(ToDo:"ToDo",done:"done")

    <$list filter="[[$ToDo$]!tag{!!title}]">
            <$set name="old" value={{$ToDo$!!tags}}>
                <$set name="new" value="$(currentTiddler)$">
                   <$button set="$ToDo$!!tags" setTo=<<addThis>> >$(currentTiddler)$</$button>
                </$set>
            </$set>
    </$list>

    <$list filter="[[$ToDo$]tag{!!title}]">
        <$tiddler tiddler="$(currentTiddler)$" >
            <$list filter="[[$done$]!tag{!!title}]">
                    <$checkbox tiddler="$done$" tag="$(currentTiddler)$">$(currentTiddler)$</$checkbox>
            </$list>
        </$tiddler>
    </$list>

    <$list filter="[[$ToDo$]tag{!!title}] +[[$done$]tag{!!title}]">
            <$checkbox tiddler="$done$" tag="$(currentTiddler)$">~~$(currentTiddler)$~~</$checkbox>
    </$list>
\end

<$macrocall $name="tasks" 
    ToDo="$:/_tasks/ToDo/$(storyTiddler)$"
    done="$:/_tasks/done/$(storyTiddler)$"
/>



The tasks created inside a journal tab of a course (see "CB-FR 1401") are taken as tasks of this course and displayed in the tasks tab.

Regards,

Alberto
Reply all
Reply to author
Forward
0 new messages