TW5 How to dynamically set default tab to current day?

280 views
Skip to first unread message

cb

unread,
May 6, 2015, 1:04:51 AM5/6/15
to tiddl...@googlegroups.com
Hi,

I have a tiddler for each day of the week, appropriately titled "Monday, Tuesday, Wednesday, etc"

I have used the "tabs" macro to set up the tabs, but currently have the default set to "Sunday"

<$macrocall $name="tabs" state="$:/state/tabs/today-date" tabsList="Sunday Monday Tuesday Wednesday Thursday Friday Saturday"  default="Sunday" class="tc-vertical"/>

Upon loading, I would like "today's" tab to the the default one.

In other words, when I load the TW5 on a Wednesday (like today'), the Wednesday tab would be the default, showing me my Wednesday items

How can I achieve this?

Thanks for all the inputs.

cb

Jed Carty

unread,
May 6, 2015, 1:19:35 AM5/6/15
to tiddl...@googlegroups.com
I don't think that there is a way in the core. I have a plugin that invokes a set of action widgets when the wiki is loaded, you could use that to set the state used by the tabs to the current day of the week. The demo wiki for the plugin is here. I haven't done any testing since 5.1.8 came out, but there shouldn't be any real problems with it. I should get around to making sure it all still works sometime soon.

Eric Shulman

unread,
May 6, 2015, 1:25:59 AM5/6/15
to tiddl...@googlegroups.com
On Tuesday, May 5, 2015 at 10:19:35 PM UTC-7, Jed Carty wrote:
I don't think that there is a way in the core. I have a plugin that invokes a set of action widgets when the wiki is loaded, you could use that to set the state used by the tabs to the current day of the week. The demo wiki for the plugin is here. I haven't done any testing since 5.1.8 came out, but there shouldn't be any real problems with it. I should get around to making sure it all still works sometime soon.

Actually, this is very easy to do with just core functions.  Simply use <<now DDD>> to calculate the current day name and then use that as the value for the default tab, like this:

<$macrocall
   $name="tabs"
   state="$:/state/tabs/today-date"
   tabsList="Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
   default=<<now DDD>>
   class="tc-vertical"/>

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

cb

unread,
May 6, 2015, 10:48:38 AM5/6/15
to tiddl...@googlegroups.com
Thank you! This works like a charm!
-cb

Alex V

unread,
May 6, 2015, 12:49:41 PM5/6/15
to tiddl...@googlegroups.com
I've got a related question. How do I open today's journal entry be default? Adding <<now "DDth MMM YYYY">> to default tiddlers doesn't work. I've tried using some different syntaxes with filters and transclusions, but I haven't been able to figure it out.

-Alex
Reply all
Reply to author
Forward
0 new messages