Conditionally format output of $view widget

78 views
Skip to first unread message

Sid

unread,
Jan 15, 2020, 2:38:57 PM1/15/20
to TiddlyWiki
Howdy!
I'm trying to customize with a plugin to show a to-do style list. Am trying to conditionally format entries based on custom fields.

My tiddlers that populate the list have a custom field 'priority'. I'd like to render the HTML output so that the value of the priority field is rendered based on their value. For example, (priority value) 'high' is in red, while others 'medium' 'low' are different colors.

Not sure how to do the above or use conditional operators in this case.


!! Outstanding tasks

<$list filter="[!has[draft.of]tag[task]!tag[done]sort[created]]">

<$checkbox tag="done">
<$link to={{!!title}}><$view field="title"/></$link> <$view field="priority"/> <br/>
<span style="color:gray;"><$view/></span>
</$checkbox>

</
$list>



* New to Tiddlywiki programming syntax, so any pointers to tutorials on TW5 programming would be additionally helpful!

Thanks,
Sid

TonyM

unread,
Jan 15, 2020, 6:44:23 PM1/15/20
to TiddlyWiki
Sid,

Not a full answer but I made some quick edits
  • Close the view widget differently
  • keep the span inside the view widget
  • Changed the BR
  • An more rearrangements.
<$checkbox tag="done"><$link to={{!!title}}><span style="color:red;"><$view field="title"/><$view field="priority"/></span></$link></$checkbox><br>

Regards
Tony

 

Not sure how to do the above or use conditional operators in this case.


!! Outstanding tasks

<$list filter="[!has[draft.of]tag[task]!tag[done]sort[created]]">

<$checkbox tag="done"></$checkbox>
<$link to={{!!title}}><span style="color:gray;"><$view field="title"/></span></$link><$view field="priority"</$view><br>


</
$list>

J Mc

unread,
Jan 16, 2020, 1:34:38 PM1/16/20
to TiddlyWiki
Hello Sid,
you may be interested in Shiraz ToDos. It has a list with priority colours.


J Mc

Sid

unread,
Jan 16, 2020, 1:57:17 PM1/16/20
to TiddlyWiki
Thanks for the replies, folks! Will check out your suggestions.
Best,
Sid
Reply all
Reply to author
Forward
0 new messages