> What I'd like is to be able to accomplish this by simply ticking a box
> - I'm envisioning something like what CheckboxPlugin can do, but with
> a date as the result, instead of "true". It seems to me this ought to
> be possible (and further down the road I see possibilities for adding
> this to a ViewTemplate, and maybe even associating it directly with
> toggling the "Done" tag). But I'm not clever enough to figure out
> how. Or maybe this is really obvious and someone has already done
> it? Any suggestions would be greatly appreciated!
You can do all of this today with CheckboxPlugin! In your
ViewTemplate, you can write:
<span macro="checkbox done [[]] [[]] [[]]
[[{store.setValue(story.findContainingTiddler(place).getAttribute('tiddler'),'completed',new
Date().formatString('YYYY/0MM/0DD'))}]] "></span>
In addition to adding/removing the 'done' tag from the current
tiddler, the checkbox also triggers an onAfterClick handler that sets
the value in the 'completed' field of the containing tiddler equal to
the current date, just as you requested.
The macro parameters in the example above are as follows:
"done" - the name of the desired target tag, stored with the current
tiddler. Setting the checkbox will add the "done" tag to the
tiddler. Clearing the checkbox removes the tag from the tiddler.
[[]] [[]] [[]] - three blank 'placeholder' parameters:
* ID for config.options.chk* (blank=value will not be saved to
config.options.*)
* onInit handler - (blank=standard checkbox initialization)
* onBeforeClick handler - (blank=standard checkbox click handling
occurs)
[[{store.setValue(...)}]] - defines the onAfterClick handler that is
triggered *after* the checkbox has performed its normal handling, so
that side-effect processing can be invoked in response to changes in
the checkbox state.
That should do it... let me know if you run into any snags...
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
http://www.TiddlyTools.com/#CheckboxPlugin
http://www.TiddlyTools.com/#CheckboxPluginInfo