transclude close tiddler button

56 views
Skip to first unread message

Dave

unread,
Apr 13, 2016, 12:35:47 PM4/13/16
to TiddlyWiki
I can transclude the "save" button and it works just fine in any tiddler

{{$:/core/ui/Buttons/save-wiki}}


But when I try to transclude the close tiddler button...
{{$:/core/ui/Buttons/close}}

although it works when viewing the original tiddler, clicking the X when transcluded does not work.



Is there a way to make this work?  I just want to put a close button at the bottom of tiddlers tagged with a certain tag

Thanks,
Dave

Dave

unread,
Apr 13, 2016, 12:41:38 PM4/13/16
to tiddl...@googlegroups.com
Nevermind.

I just took the contents of the

[[$:/core/ui/Buttons/close]]:

<$button message="tm-close-tiddler" tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class=<<tv-config-toolbar-class>>>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/close-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Close/Caption}}/></span>
</$list>


</$button>

and put it into the stylesheet and it works just fine

Eric Shulman

unread,
Apr 13, 2016, 1:05:13 PM4/13/16
to TiddlyWiki
yes... just add "||" in front of the tiddler title, like this:
{{||$:/core/ui/Buttons/close}}

This will cause the tiddler to be transcluded, but will use the current tiddler as the 'context' (i.e., the content comes from the named tiddler, but the data comes from the current tiddler).  This allows the close action to be performed on the current tiddler, rather than the tiddler being transcluded.

enjoy,
-e




Hegart Dmishiv

unread,
Apr 13, 2016, 1:56:09 PM4/13/16
to TiddlyWiki
Hi Eric,

I'm trying to use this solution in my {{DesignWrite}} semester project, TiddlyCRM, here (at line 11). It works fine in that tiddler, but when I try to transclude that tiddler using a ViewTemplate like this one, it only closes the original $:/_Menu/TopBar tiddler (if it was open at the time), but nothing else.

Hegart.

Eric Shulman

unread,
Apr 13, 2016, 3:14:10 PM4/13/16
to TiddlyWiki
On Wednesday, April 13, 2016 at 10:56:09 AM UTC-7, Hegart Dmishiv wrote:
I'm trying to use this solution in my {{DesignWrite}} semester project, TiddlyCRM, here (at line 11). It works fine in that tiddler, but when I try to transclude that tiddler using a ViewTemplate like this one, it only closes the original $:/_Menu/TopBar tiddler (if it was open at the time), but nothing else.

You didn't use the "double-bar" syntax when you transcluded {{$:/_Menu/TopBar}}.  It should be {{||$:/_Menu/TopBar}}, so that the current tiddler is in context.

Also, you have an unterminated <$list> widget at the beginning of the tiddler with a filter="[is[current]]", which will ALWAYS be true, so the $list widget does nothing except set the currentTiddler variable equal to... the value of the currentTiddler variable (i.e., the value is UNCHANGED by the $list widget action).  Thus, this syntax is both unneeded and ineffective and can be removed from your template.

enjoy,
-e


P.S.  I'm looking into the combobox problem you reported (how to set a value other than the selected tiddler title).


Hegart Dmishiv

unread,
Apr 13, 2016, 3:24:06 PM4/13/16
to TiddlyWiki
Hi Eric,

You didn't use the "double-bar" syntax when you transcluded {{$:/_Menu/TopBar}}.  It should be {{||$:/_Menu/TopBar}}, so that the current tiddler is in context.

Aha! Thanks for that. Solved.
 
Also, you have an unterminated <$list> widget at the beginning of the tiddler with a filter="[is[current]]", which will ALWAYS be true, so the $list widget does nothing except set the currentTiddler variable equal to... the value of the currentTiddler variable (i.e., the value is UNCHANGED by the $list widget action).  Thus, this syntax is both unneeded and ineffective and can be removed from your template.
 
Right, that makes sense. I was just following the method I was taught in the {{DesignWrite}} course, when creating ViewTemplates. In this particular instance I specifically wanted the template to be applied to every tiddler being viewed, so I thought I needed to be explicit about that in the ViewTemplate. I wasn't aware that it is the default action, as you explain here, so thanks for that.

P.S.  I'm looking into the combobox problem you reported (how to set a value other than the selected tiddler title).

Awesome, thanks, that would be really helpful with restricting the results of one combobox by the selection of another. Looking forward to getting that part going.

Hegart.
Reply all
Reply to author
Forward
0 new messages