Hello.
I am modifying my Tw so that it generates certain types of tiddlers using a template in order to create them uniformly and always with all the fields and labels that I need.
Everything works fine for me but I have a specific case for which I cannot find a solution. This is the Sources category, in which I group: books, electronic books, newspaper articles, internet articles, etc…
Since I want each of these source classes to have different fields, I have three templates to create them. The way I do it I would need 3 buttons to get what I want.
My question is: can I use a single button to choose the template I want to use and have the tiddler generated?
Example: I want to generate a book tiddler within the sources category tab. Then I press the generate new tiddler button within the sources tab and it gives me the option to generate a book, and newspaper article, and another document.
I choose the one that interests me and the corresponding template opens so I can fill out the fields and save the tiddler.
This is the code I use for the button:
\import plugins/kookma/thinkup/templates/equipos
<$tiddler tiddler=<<currentTab>>>
<$let new-item-title={{{[{!!title}]}}}>
<div class=float-right style=margin-right:20px;>
<$button class="btn btn-sm" tooltip="New" entry=<<createNewItem>>>
+ <$text text="New entry"/>
</$button>
</div>
</$let>
And this is one of the templates I usually use:
\define createNewItem()
<$action-sendmessage
$message="tm-new-tiddler"
title=<<unusedtitle """New $(new-item-title)$""">>
tags="[[$(currentTiddler)$]]"
imagen="$:/plugins/kookma/thinkup/images/mr_avatar"
caption="pié de foto"
text=<<content>>
keywords=""
/>
\end
\define content()
<table class="table-borderless source">
<tr><th>Título</th><td></td></tr>
<tr><th>Autor</th><td></td></tr>
<tr><th>Año</th><td></td></tr>
<tr><th>Formato</th><td>pagina-web informe libro electrónico blog periodico podcast</td></tr>
<tr><th>Enlace</th><td></td></tr>
<tr><th>Valoración</th><td>malo normal bueno excelente</td></tr>
</table>
<$macrocall $name=image-pretty img={{!!imagen}} align="right" caption={{!!caption}} tooltip={{!!caption}} alt=""/>
;Descripción
: <<.lorem>>
;Observaciones
: <<.lorem>>
\end
Greetings.