\whitespace trim
<$button message="tm-new-tiddler" param=<<currentTiddler>> tooltip="Clone this 'template'" aria-label="Clone this 'template'" class=<<tv-config-toolbar-class>> >
<$action-setfield $field=template-source $value=<<currentTiddler>>/>
<$action-deletefield $field=tiddler-template-caption/>
{{$:/core/images/clone-button}}
</$button>
Thanks, I have used the work around to indicate template tiddlers by creating a matching tiddler templatename/template
In someways this may be better because the templatetiddler is now totaly cloned.
Regards
Tony
\whitespace trim
<$button tooltip="Clone this 'template'" aria-label="Clone this 'template'" class=<<tv-config-toolbar-class>> >{{$:/core/images/clone-button}}
<$vars tiddler-template-caption={{!!tiddler-template-caption}}>
<$action-deletefield $field="tiddler-template-caption"/>
<$action-setfield $field=template-source $value=<<currentTiddler>>/>
<$action-sendmessage $message="tm-new-tiddler" $param=<<currentTiddler>> >
<$action-setfield $field="tiddler-template-caption" $value=<<tiddler-template-caption>>/>
<$action-setfield $field="do-i-happen" $value="Important stuff"/>
</$vars>
</$button>Enter code here...
As I posted I am happy to use the existence of a /template subtiddler because I can simply use a custom clone button. In fact I can see being able store additional info about the template or even listing the resulting tiddlers.
However I have thought of allowing check boxes on each field of one tiddler to copy or append to a target tiddler. Similer to how you suggest.
Regards
Tony
I am using sub to suggest subordinate. Using the /template name after the tiddlername.
Tiddlername (actual template)
Tiddlername/template existing means tiddlername is a template.
Thus every tiddler with suffix[/template] says there is a template tiddler called removesuffix[/template]
When I clone templatename to templateinstance the subtiddler is not cloned and I do not need to modify the new tiddler
Regards
Tony
<$button message="tm-new-tiddler" param=<<currentTiddler>> tooltip="Clone this 'template'" aria-label="Clone this 'template'" class=<<tv-config-toolbar-class>> >
<$action-setfield $field=template-source $value=<<currentTiddler>
>/>
{{$:/PSaT/newTiddler/icon.svg}}
</$button>
\define actions()
<$action-setfield $tiddler="testtemplate" $field="title" $value="MyNewTiddler" />
<$action-deletefield $tiddler="MyNewTiddler" $field="field2" />
\end
<$button actions=<<actions>>>
Create and remove field
</$button>
I will try it on sunday morning in around 10 to 11 hours.
I appreciate your help.
I must remember to document the final solution well because have wasted too much time on this even although I have learned some new things.
Regards
Tony
\define catvalue() <$text text="""$(value2)$"""/>
\define fieldsvalues()
<$list filter="[all[current]fields[]] -[[tiddler-template-caption]] -[[text]]" variable="field"><$set name="value2" tiddler=<<currentTiddler>> field=<<field>> emptyValue=""><<field>>="<<catvalue>>" </$set> </$list>
\end
\define buttonactions() <$action-createtiddler $basetitle={{!!title}} $(attribs)$ text={{!!text}} />
<$wikify name="attribs" text=<<fieldsvalues>> >
<$button actions=<<buttonactions>>>Create clone
</$button>
</$wikify>
\define fieldname-value() <$text text="""$(fieldname-value-temp)$"""/>
\define fieldsvalues()
<$list filter="[all[current]fields[]] -[[tiddler-template-caption]] -[[text]] -[[title]] -[[created]] -[[modified]] -[[tiddler-template-caption]]" variable="field"><$set name="fieldname-value-temp" tiddler=<<currentTiddler>> field=<<field>> emptyValue=""><<field>>="<<fieldname-value>>" </$set> </$list>
\end
\define clone-current-actions()
<$action-createtiddler $basetitle={{!!title}} $savetitle="$:/temp/clone-current-title" $(attribs)$ text={{!!text}} />
<$action-navigate $to={{$:/temp/clone-current-title}}/>
\end
\define clone-template-actions()
<$action-createtiddler $basetitle={{!!instance-of}} $savetitle="$:/temp/clone-template-title" $(attribs)$ text={{!!text}} />
<$action-navigate $to={{$:/temp/clone-template-title}}/>
\end
\define clone-tiddler(tiddlername)
<$set name=tiddlername value="$tiddlername$" emptyValue=<<currentTiddler>> >
<$tiddler tiddler=<<tiddlername>> >
<$wikify name="attribs" text=<<fieldsvalues>> >
<$button actions=<<clone-current-actions>>class=<<tv-config-toolbar-class>> >Clone
</$button>
</$wikify>
</$tiddler>
</$set>
\end
\define new-template-instance(tiddlername,tags)
<$set name=tiddlername value="$tiddlername$" emptyValue=<<currentTiddler>> >
<$tiddler tiddler=<<tiddlername>> >
<$wikify name="attribs" text=<<fieldsvalues>> >
<$button actions=<<clone-template-actions>> class=<<tv-config-toolbar-class>> >New Instance
<$action-sendmessage $message="tm-edit-tiddler" $param={{$:/temp/clone-template-title}}/>
</$button>
</$wikify>
</$tiddler>
</$set>
\end
;Named tiddler
New Order<<clone-tiddler "$:/New order/template">> Clone
New Order<<new-template-instance "$:/New order/template">> Template
;On current tiddler
Clone this<<clone-tiddler>>
Template this<<new-template-instance>> Only works if the current tiddler has an "instance-of" field with a basetitle