Hi folks, I have long wanted an easy way to add a condition to tabs and buttons and was recenly looking at editor toolbar buttons, they use the condition field and typicaly test the type field to determin if they should display the button or not.
I raise this RFC because this feature would idealy be implemented in the core eventualy
I have often wrapped the body content of buttons in a display condition and buttons will not show if this condition is appropriate. But for consistency I am modifying the toolbar UI elements to also test the condition field before display. By default if there is not condition fields or its empty there is no change.
However this is not true for the tabs macro, all tabs will show until you remove the validity of the filter that includes it eg; remove “$:tags/sidebar” so I have rewritten it to also first look at the condition field before displaying the tab. This allows individual tabs to have their own conditions.
- Possibly a key use is when in read only, author or designer modes.
- I have more to say on that later.
I am progressivly implementing this as a Proof of concept here conditional-elements feel free to have a look and use differences from shadow to see my modifications.
RFC Request for comment - current solution
I am seeking feedback on how I have coded my solution because although I can deliver it by package or plugin initialy it ONLY changes core UI tiddlers and I would hope eventualy to petition for this to be included in the next release.
But there is a little, more for shadows
Inevitably people will want to add a condition field to a range of existing core UI tiddlers and this will both interfear with core upgrades and make the wiki larger, as we then need to store the shadow and the tiddler in the wiki, such as the sidebar and other tabs, I would like to implement an additional method so;
if there is no condition field on a given tab or button it first looks for an external condition specified for the tiddler.
This is where I also seek COMMENT what do you think is the best way to achive this? Options may include;
- A data tiddler containing the tiddler title and the value is the condition
- A tiddler for each tiddler having an overide condition (like the visibility ones)
- $:/config/conditions/ tiddlername containing the condition in its test field
- Perhaps a condition tag or cascade mechanisium so different solutions can contribute additional conditions to display or hide the item
- Another idea I have is a virtual field, one of any number fields people can add to a single additional tiddler I refer to as a ghost tiddler.
- Many other features could be built into this, but other plugins would be able to leverage this as well.
- Or some other approach?