Hello,
I wrote a set of tiddlers to suppress the body of tiddlers tagged “Evaluation” and replace it with the content wrapped in a <$let> widget to redefine some variables. Normally these tiddlers are transcluded in the context of another tidder that defines these but I wanted it to display the same thing when the “Evaluation” tidder was viewed separately in the story river or when popped out as a separate window.
So I have a tidder tagged with $:/tags/ViewTemplate that contains:
<$list filter=[is[current]tag[Evaluation]]>
<$let ... some variables redefined ...>
{{}}
</$let>
</$list>
And a tidder with $:/tags/ViewTemplateBodyFilter that contains:
[tag[Evaluation]then[$:/core/ui/ViewTemplate/body/blank]]
and I moved that up just before the “default” ViewTemplateBodyFilter in the list.
After sorting through some plugin issues, things seem to work well in the story river. The expected content is there in the right context.
However, I have encountered a follow up problem in that the text is also suppressed in the editor preview also. Is there a way to exclude the ViewTemplateBodyFilter filter from the preview panel or make the ViewTemplate work in the context of the preview panel to add it back? There doesn’t seem to be a separate “preview” step in the cascade.
Thanks,
/Mike
Maybe refine the filter to exclude drafts? Not tested:
[tag[Evaluation]!is[draft]then[$:/core/ui/ViewTemplate/body/blank]]
Just a guess,
Fred
Good idea. That solves a problem that I didn’t know I had.
But I am actually calling the editor directly from within a <$list> of Evaluations using {{||$:/core/ui/EditTemplate/body}}.
But it does get me thinking that I can mark the context of that in some way to exclude that from my ViewTemplateBodyFilter.
Thanks,
/Mike
Thanks. Your answer fixed a problem I hadn’t discovered yet and also led me to the solution.
Now I call the editor using:
<$list filter=[tag[Evaluation]]>
...
<$let editorInList="yes">{{||$:/core/ui/EditTemplate/body}}</$let>
...
</$list>
and then made another ViewTemplateBodyFilter and set it with a higher precedence:
[<editorInList>match[yes]then[$:/core/ui/ViewTemplate/body/default]]
Maybe more complicated than it should be but I couldn’t get a single filter to work.
Thanks,
/Mike
Nevermind … not solved. It appears that when I fixed one thing I broke another. Now when I view the tidder in a separate window. It is blank : [
Backing up and thinking more about it, in the end, I was being more complicated than I needed to be. I thought that I had to keep the $:/core/ui/ViewTemplate/body/default and just add to it but in the end the solution was much simpler. Just don’t make my template a system-wide ViewTemplate and point the ViewTemplateFilter at that.
So I have a tidder not tagged with $:/tags/ViewTemplate now that contains:
<$let ... some variables redefined ...>
{{}}
</$let>
And a tidder with $:/tags/ViewTemplateBodyFilter that contains:
[tag[Evaluation]then[Name of Tidder Above]]
and I moved that up just before the “default” ViewTemplateBodyFilter in the list.