On Thursday, November 5, 2020 at 12:32:48 PM UTC-8, David Gifford wrote:
>
> Eric you never cease to amaze me. Thank you for that. I like the button
> options in this approach. Question: since the whole point in my case is to
> transclude existing tiddlers in modals, I would need to replace all
> existing instances of $:/temp/modal in this snippet with the title of my
> tiddler? And maybe delete the text="" part?
>
Try this:
\define showModal(tid)
<$button> open modal: <$text text="$tid$" />
<$action-setfield $tiddler="$:/temp/modal/$tid$"
subtitle="$tid$"
text={{{ [[$tid$]get[text]] }}}
footer="""
<$button message="tm-close-tiddler"> close
<$action-deletetiddler $tiddler="$:/temp/modal/$tid$"/>
</$button>
<$button message="tm-close-tiddler"> view
<$action-listops $tiddler="$:/StoryList" $subfilter="[[$tid$]]"
/>
<$action-deletetiddler $tiddler="$:/temp/modal/$tid$"/>
</$button>
<$button message="tm-close-tiddler"> edit
<$navigator>
<$action-sendmessage $message="tm-edit-tiddler" $param="$tid$" /
>
<$action-listops $tiddler="$:/StoryList" $subfilter="[[Draft of
'$tid$']]" />
<$action-deletetiddler $tiddler="$:/temp/modal/$tid$"/>
</$navigator>
</$button>
""" />
<$action-sendmessage $message="tm-modal" $param="$:/temp/modal/$tid$" />
</$button>
\end
Notes:
* In addition to the "text" field, the modal tiddler needs to have a
"subtitle" and "footer" field.
* Rather than modifying the actual tiddler, the macro creates
$:/temp/modal/NameOfTiddler
* Each of the buttons, in addition to performing the desired actions, also
cleans up after itself by deleting the $:/temp/modal/... tiddler
* You can tag the above with $:/tags/Macro, and then invoke it using
<<showModal "NameOfTiddler">>
enjoy,
-e
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/5e627210-67e7-4983-82f4-59df5504904do%40googlegroups.com.