<$button
disabled=<<giftSelectionEmpty>>
actions=<<g-create-link-person-gift( {{!!title}}, {{!!temp-gift}}, "todo" )>> >
To Gift
</$button>
I’m stumped on the required syntax to pass & call the 3 parameters. I’ve seen suggestions about using$transclude instead of <<macro>> for increased flexibility but I don’t understand how to apply that to $button's parameters.
incidentally are you placing global functions in a tiddler with the global tag, and rather than repeating code for each person put it in a tiddler with a view template tag?
wrapping your code in the view template with a list widget to only display on person tiddlers
These are arguably the best practice for such things.
I only ask because your words suggest you are not?
Yes on both fronts. I’ll have the aforementioned procedure in a Procedures tiddler tagged with $:/tags/Global and I’ll be applying it to all persons with a ViewTemplate. I’ll also be using it on all gifts for the same reason, but approaching it from the opposite direction.
The goal is to have the following:
On each person I want to select an available gift and create the appropriate link tiddler.
On each gift I want to select an available person and create the appropriate link tiddler.
Using {{!!title}} breaks the above approach; on half the cases it means “person’s name” and on the other half it means “gift’s name”.
Yes, we tend to write a lot of tiddlywiki script using the current title, and the list widget for example alters the variable <<currentTiddler>> but you can set a different variable name too eg variable=person. Another little trick if the currentTiddler has changed can be to revert to the <<storyTiddler>>