Could we replace the code of $:/core/ui/SideBar/Open with list-links-draggable and a template

The advantage would be that using list-links-draggable, with the same or less amount of code we could add a $:/core/ui/ListItemTemplate_with_CloseButton that could be reused in other draglist szenarios . Because in most case if I drag around items in lists I want to be able to remove them.

I had a problem getting this to work:

If given:

<<list-links-draggable  itemTemplate:"$:/plugins/JJ/drag-and-close" type:"div" subtype:"span">>

no
What is wrong with this $:/plugins/JJ/drag-and-close

<$link tooltip={{!!title}} >
<div style="width:100%;text-align:left;padding-top:4px"><<targetTiddler>>
<$button class="tc-btn-invisible">{{$:/core/images/cancel-button}}
<$action-listops $tiddler=<<targetTiddler>> $subfilter="-[<currentTiddler>]"/>
</$button><<!--the title which allows to sho an optional alias
<$list filter="[all[current]has[alias]]" emptyMessage={{!!title}}>{{!!alias}}</$list>
</div>
</$link>

Hi @JanJo,

This code seems to work:

<div style="width:100%;text-align:left;padding-top:4px">
<$button class="tc-btn-invisible">{{$:/core/images/cancel-button}}
<$action-listops $tiddler="$:/StoryList" $subfilter="-[<currentTiddler>]"/>
</$button>&nbsp;<$link tooltip=<<currentTiddler>>><$list filter="[all[current]has[alias]]" emptyMessage={{!!title}}>{{!!alias}}</$list></$link>
</div>

along with:

<<list-links-draggable tiddler:"$:/StoryList" itemTemplate:"$:/plugins/JJ/drag-and-close" type:"div" subtype:"span">>

Fred

Hi @tw-FRed thank you.
This works for the $:/StoryList - I would like it to work for any given list-links-draggable-macro using the targetTiddler Variable

I don’t know if that would work on any use of list-link-draggable macro without changing it’s macro call, but below code (modified in order to use <<targetTiddler>>) works on tiddlywiki.com:

Template code:

<div style="width:100%;text-align:left;padding-top:4px">
<$button class="tc-btn-invisible">{{$:/core/images/cancel-button}}
<$action-listops $tiddler=<<targetTiddler>> $subfilter="-[<currentTiddler>]"/>
</$button>&nbsp;<$link tooltip=<<currentTiddler>>><$list filter="[all[current]has[alias]]" emptyMessage={{!!title}}>{{!!alias}}</$list></$link>
</div>

and the macro call:

Calling code:

<$let targetTiddler="$:/StoryList">
<$transclude $variable="list-links-draggable" tiddler=<<targetTiddler>>  itemTemplate="$:/plugins/JJ/drag-and-close" type="div" subtype="span"/>
</$let>

Note: in the macro call I used the modern <$transclude> widget, but it should be easy to adapt to an older TW version by using the <$macrocall> widget instead.

Fred

1 Like

Thank you. It even works without the charging the targetTidler form outside, just with: <$transclude $variable="list-links-draggable" tiddler="$:/StoryList" itemTemplate="$:/plugins/JJ/drag-and-close" type="div" subtype="span"/>

See here: NewStorylist.json (794 Bytes) .

But I still do not know why it did not work before…

And here audaciously renamed to replace $:/core/ui/SideBar/Open

New $:/core/ui/SideBar/Open.json (973 Bytes)