I have some rows of tabs macros. They are not all nested but some are independent from another.
I want a tabs macro to close all of it’s tabs.
First I just added a tab with “X” as caption and an emtpy text-field. This looked closed but now I use ViewTemplates so my empty “looks-like-closed” tab is filled with the ViewTemplate.
If I make an extra button with ActionSetFieldWidget to delete the text of the state-tiddler, I have to manually set the qulifyier-number and the button looks kind of off.
I did not understand the action parameter. Is it possible to set it to a single tab, so that selecting this tab deletes the text in the state-tiddler? And eaven then you need to know the qualifyer.
The above can probably be prevented by styling it so that the ViewTemplate content doesn’t show in the particular location that the tabs macro is in.
E.g you can probably do something like this
<<tabs "SampleTabOne SampleTabTwo SampleTabThree SampleTabFour FOO" "SampleTabOne" "$:/state/tab1" class:"foo">>
<style>
.tc-tab-content.foo div:last-of-type {display:none}
</style>
Hi @Hanlon
You can enclose your ViewTemplate within this <$list>
widget:
<$list filter="[<currentTab>!tag[CloseTab]]" emptyMessage="" variable="none">
<!-- Your original ViewTemplate code here -->
</$list>
And then you tag your “close tab” with CloseTab
.
Fred
OK, I just updated it a bit. test it again.
@twMat Thanks for the fast input! Your solution seams to work at first glance but it does not, when I try to implement it with my ViewTtemplates. It would be elegant as it has to be implemented in only one place (the tabs macro).
@tw-FRed Thanks! Your solution works. I plan to have multiple switchable layouts and the filter has to be implemented in every ViewTemplate so I am still looking for an alternative…
I made a showcase with a non-functional example. https://closetabs.tiddlyhost.com/
Backing up a bit:
What do you actually mean with this? Why would you have a ViewTemplate inside a tabs content??? If you just have “no content” in the tab, it will remain empty so that when you click its tab then the full tab set will show as you want, no?
Most tabs contain informations. (all but the closed-tab)
This information is stored in fields and relies on currentTiddler to be shown. To use those fields and currentTiddler in the tabs I need to use a template in general last paragraph. I name them “TabsEnabler”. They also present the specific ViewTemplate (eg Recipe).
I do call this template in the tabs macro so the template is applied to all tabs. I do not know how to exclude the “close-tab” from that ViewTemplate.
In my example you can see, that the lower tabs macro tries to show every tab as a recipe. So it show the empty-tab with the CSS-pattern for the recipe. (More visable, if you choose Layout02 in the SideBar.)
maybe this for the template
<$list filter='[<currentTab>!match[FOO]]'>
<$tiddler tiddler=<<currentTab>>>
<$transclude tiddler="Layout01/ViewTemplate" mode="block" />
</$tiddler>
</$list>
Thank You!
That does the trick.
A filter in the “TabsEnabler”.
back to tinkering with CSS-patterns (and being able to use them nicely in tabs)
I just thought I would drop a note here that the tabs macro is given a filter which determins the tabs to be shown, however there are cases where we may want individual tabs to be displayed “only given particular conditions”. Including as in this thread when they are “open” vs “closed”.
I have a project off line where I am researching the possibility of adding a display-filter on various elements in tiddlywiki so you can add a “contitional display”, This extends to allowing a display filter to be set for core tiddlers without editing them. The following elements may benifit;
- Tabs eg custom, sidebar and other tab driven menus.
- eg settings/Plugin tabs
- Buttons, we already have a method per-button
- Menu bar
- View and Edit template elements
- Items listed via a custom list widget
The idea is to operate as normal but provide a mechanisium to add “conditional display” to any standard element.
- If anyone can nominate elements in tiddlywiki that could benifit from conditional display please let me know.
First I will make a package and later see if it can move into the core as a dejure standard.