[TW5] How to add parent tag of tiddler when using a separate tiddler as a data entry form

98 views
Skip to first unread message

reakt...@gmail.com

unread,
Nov 22, 2016, 1:48:03 PM11/22/16
to TiddlyWiki
Greetings!

I'm working on a project to create documentation around a Minecraft server I'm attempting to set up. I created a button to bring up a tiddler as a data entry form to create the tiddlers for each plugin. I'm now trying to create buttons to have them added on creation of a plugin tiddler to add permissions as well as slash commands.

I'd like to have my tiddlers for slash commands as well as permissions include the parent tag (the name of the plugin tiddler). The problem I'm running into is that I made the buttons to launch data entry tiddlers and if I'm attempting to create a new slash command tiddler, I'm not sure how to add the tag of the parent tiddler to the new one.

Using <<currentTiddler>> doesn't work because technically the current tiddler is the data entry form. I've tried using bits and pieces from TiddlyPack, CategoryLists, and bottomOfTiddler macro but I can't seem to wrap my head around this. My current project can be viewed at http://minecraft.tiddlyspot.com/

Example:

- Click on Plugins
- Click Add Plugin
- Entry the plugin name
- Click Save and then Close
- Click the title of the newly created plugin tiddler
- Clicking the button for adding a slash command should open a data entry form tiddler however, the new tiddler created should also be tagged with the name of the plugin

Jed Carty

unread,
Nov 25, 2016, 9:18:04 AM11/25/16
to TiddlyWiki
It is nice to see that someone is actually using something I made. I am not certain exactly what you want in all of this, but for tagging the tiddler created with the plugin there are two ways to do it that I can think of right now. One would be to have the button that opens the modal set a field in some state tiddler and then add that to the end of the line setting the tags like this in the tiddler $:/_mc/frm/Slash Cmd Entry:

<$set name=MCSCTags filter='[[Minecraft]][[Plugin Slash Cmd]][[[[$:/_mc/tmp/addSlashCmd/tags]tags[]][{$:/_mc/tmp/addSlashCmd/tmp!!current_plugin}]'>

and update the button in the tiddler $:/_mc/btn/addMCPSlashCmd to add this:

<$action-setfield $tiddler='$:/_mc/tmp/addSlashCmd/temp' $field='current_plugin' value={{!!title}}/>

to make this you you also need to edit the $:/_mc/btn/addMCPSlashCmd tiddler, add the tag $:/tags/Macro to it and remove <<addMCPSlashCmd>> from the bottom. Then instead of putting {{$:/_mc/btn/addMCPSlashCMD}} to the plugin tiddler you add <<addMCPSlashCmd>> instead. Or even better use a conditional view template so that you don't have to do anything to the plugin tiddlers text field.

The other way would be to not use modals and have the buttons instead open a reveal widget that has the contents of the modal inside it. That lets you use things like <<currentTiddler>> easier.

BJ

unread,
Nov 25, 2016, 12:43:14 PM11/25/16
to TiddlyWiki
It is possible to add variables to the modal:

<$action-sendmessage $message="tm-modal" $param="$:/_mc/frm/Slash Cmd Entry" text="" x="$(x)$"/>

and you can create the value of x by adding:
<$action-setfield $tiddler="""$(MCPlugin)$""" $field=text $value="<$vars x=<<currentTiddler>>>{{$:/_mc/btn/addMCPSlashCmd}}<$/vars>"/>

to your $:/_mc/btn/saveMCPlugin

then in your $:/_mc/btn/saveMCSCmd have

<$action-setfield $tiddler='$:/_mc/tmp/addSlashCmd/tags' $field='tags' $value=$(x)$/>


all the best BJ

Josiah

unread,
Nov 25, 2016, 4:01:19 PM11/25/16
to TiddlyWiki
Mr BJ

I have to say you are a man that DOES.

J, x
Reply all
Reply to author
Forward
0 new messages