How to limit display of subtitle viewtemplates to the currentTiddler

I am doing some experiments with an alternate UI in one of my wiki. This is just in the experimental phase. So there may be many mistakes.

These are the changes I made.
I removed the viewtemplate tag from the core/viewtemplate/title and created a custom tiddler header consisting of caption or title (whicheveris available) , tag and selected viewtoolbar buttons.

Now coming to my question:
I am using some buttons in the subtitle to toggle display of certain subtitle viewtemplates. Its working ok, but the problem is that display of subtitle viewtemplates is not limited to the currentTiddler . instead all the tiddler in the storyriver display the custom subtitle viewtemplate when toggle buttons in the subtitle is clicked.
Can someone help to correct this. The demo can be found here. Press on the subtitle buttons to see what’s is happening
These are the relevant tiddlers for metadata subtitle viewtemplate

Brief mobile response:

  1. that’s a neat ui trick!! Interested to see where you go with it. :0
  2. I feel like storyTiddler (or thisTiddler?) might be worth looking at, or oh! The counter variable in $list, which I’ve seen as a fix for all tagpills opening at the same time…?

Your meta buttons need to change a “state” tiddler that is responsible for only one tiddler. eg:

\function getState() [[$:/state/meta]] [<currentTiddler>] +[join[]]

If you click a meta button, they need to write the requested state to this tiddler.
The view template also needs to use this state tiddler to show the template accordingly.

Or you can also store this in a field within each individual tiddler instead of $:/state tiddlers to ensure they are not removed or lost

@arunnbabu81 I would recomend a different approach.

  • First decide on how you will choose between tiddlers with or without your alternate title subtitle.
    • I tend to use object-type=custom you may add this at creation, from a template or create a button to toggle it on/off on a given tiddler. With this method a tiddler can only be one object-type at a time.
  • Now you can tell them apart have a look at the cascade mechanisums specificaly in this case for the “View Template Title” cascade to handle captions.
    • With the view template cascade you can use an alternative for tiddlers with object-type=custom or do it for all tiddlers (eg with a caption)

Here is one to display captions I wrote in 5mins showCaptions.json (543 Bytes) show captions in titles of all tiddlers.

With the subtitle Personaly I would not remove the existing subtitle, but I would add an additional subtitle component with $:/tags/ViewTemplate/Subtitle and make what is displayed dependant on the condition you have decided on eg object-type=custom. This will only show with your custom tiddlers and can display your submenu. Otherwise modify $:/core/ui/ViewTemplate/subtitle with you condition test.

I have not provided all the details here of using the cascade mechanisium but it is powerful tool once you learn how to use it.

Thanks everyone for replying.

Thank you. I was actually experimenting with the subtitle cascades to display fields, backlinks and other metadata by a different UI. But it got diverted and I started modifying the rest of the UI. I dont plan to modify any core tiddlers so that there wont be any issues in the future. Only thing I have done with core viewtemplate tiddlers is removing their viewtemplate tag. There is so much work left to make this useable. So I don’t know how far this experiment will proceed.

@pmario I tried to do it - But I don’t know to do it correctly. Take a look at these tiddlers - 1 and 2 . Can you please correct it ?

Once I understand how to use the state tiddler, I will check this approach

@TW_Tones I will check this approach. Already I am using the subtitle cascade in this experiment. Are you proposing something different ?
I am planning to make it into a theme so that I can switch to the default UI if needed

  • Only that your caption/title can use a cascade
  • And you could add a condition within a subtitle item
  • Did you try the example I shared?

I did try it. But I want to remove the default viewtoolbar and tag ui. For that I am using this css .

.tc-tiddler-title, .tc-tags-wrapper {
display: none;
}

With this css, the title also can’t be displayed. That’s why I opted for an alternative to default title.

Now I changed the css as below

.tc-tiddler-controls, .tc-tags-wrapper {
display: none;
}

Now I can use the solution you provided. Thank you @TW_Tones

Can this be modified to use always instead of using only when there is a caption.

Yes, easily, are you sure you want it on every tiddler?

  • I will give you a replacement soon, hopefuly before my bed time

I think as it stands it works the same for all tiddlers including system tiddlers.

What is the outcome you want?

[Edited] What I gave you was more of an illustration for you to taylor.

I am combining the title tag and toolbar into the viewtemplate title and hiding the default UI. So I need tiddler controls and tag UI for the tiddlers without caption.

@arunnbabu81 sorry, I don’t follow. I can revisit tomorrow afternoon and I am afraid I am too tired.

If you use the example I gave you and make the cascade filter for the title use your preferred title format it should work, although to hide the toolbar buttons you may look at the story tiddler cascade.

  • Sorry, but I am exhausted, best of luck and I will look tomorrow after a medical appointment.