new-journal-here button how to add currentTiddler to name?

46 views
Skip to first unread message

Sapphireslinger

unread,
Jan 8, 2021, 1:02:50 AM1/8/21
to TiddlyWiki
I am trying to create a new-journal-here button embedded in my tiddler "Class Log - Jane Doe". I want it to create a tiddler titled "year.month.day hour Class Log- Jane Doe" which is tagged with [bible study session] and [Class Log - Jane Doe]

In other words:
* Title: "date currentTiddler"
* Tags: [bible study session] [currentTiddler]

I thought all I had to do was clone $:/core/ui/Buttons/new-journal-here button, give it the new name $:/core/ui/Buttons/new-class-log-entry-here, add [bible study session] to the tags, and embed it in any "Class Log - Jane Doe" like tiddlers like so: {{Class Log- Jane Doe||$:/core/ui/Buttons/new-class-log-entry-here}}

Problem:
Clicking that button in the Class - Jane Doe tiddler results in a tiddler with the correct tags, but the title only has a date stamp, not "date-stamp currentTiddler".

\whitespace trim
\define journalButtonTags()
[[$(currentTiddlerTag)$]] [[bible study session]]
\end
\define journalButton()
<$button tooltip={{$:/language/Buttons/NewJournalHere/Hint}} aria-label={{$:/language/Buttons/NewJournalHere/Caption}} class=<<tv-config-toolbar-class>>>
<$wikify name="journalTitle" text="""<$macrocall $name="now" format=<<journalTitleTemplate>>/>""">
<$action-sendmessage $message="tm-new-tiddler" title=<<journalTitle>> tags=<<journalButtonTags>> journal-date=<<now "YYYY0MM0DD0hh0mm0ss0XXX">>/>
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
{{$:/core/images/new-journal-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]">
<span class="tc-btn-text">
<$text text={{$:/language/Buttons/NewJournalHere/Caption}}/>
</span>
</$list>
</$wikify>
</$button>
\end
<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}>
<$set name="journalTags" value={{$:/config/NewJournal/Tags!!tags}}>
<$set name="currentTiddlerTag" value=<<currentTiddler>>>
<<journalButton>>
</$set>
</$set>
</$set>

Sapphireslinger

unread,
Jan 8, 2021, 1:14:31 AM1/8/21
to TiddlyWiki
I was originally trying to do something like this. Spent hours trying to figure out what to put in the yellow spot:

\define newtags() [[$(currentTiddler)$]] [[bible study session]]

<$list filter="[<currentTiddler>prefix[Class Log - ]] ">
<$button> Class Log - New Entry
      <$action-sendmessage $message="tm-new-tiddler" title=<<now "YYYY.0MM.0DD.0hh0mm $(currentTiddler)$" >> tags=<<newtags>> />
   </$button>
</$list>

Then I got the bright idea of cloning new-journal-here button and think the new-journal here icon is smaller and nicer-looking than a grey button.

1. However could someone please tell me what I ought to have put in the yellow space?

2. Also, this code seems to take up a lot less space than the new-journal-here code, not to mention it gets macro'd into any pertinent tiddlers instead of pasting it over and over again into the pertinent tiddlers, bloating the wiki. Any way to get it to be the new-journal here icon instead of a grey button?

Odin

unread,
Jan 8, 2021, 1:47:52 AM1/8/21
to TiddlyWiki
You can use the wikify widget to create a title like that: 

<$wikify name="classLogTitle" text="""<<now "YYYY.0MM.0DD.0hh0mm " >> <<currentTiddler>>""">

And then replace the yellow part with: <<classLogTitle>> to pass the wikified bit as the text. To create the new journal button, you can use the class="tc-btn-invisible" to hides the button part (you'll be left with just text). Now you can replace the text with any icon you want, such as the new journal icon. Also note that the  [[$(currentTiddler)$]] [[bible study session]] part can be removed and the button still works. I am not sure what it is for.

Full solution:


\define newtags() [[$(currentTiddler)$]] [[bible study session]]

<$wikify name="Title" text="""<<now "YYYY.0MM.0DD.0hh0mm " >> <<currentTiddler>>""">

<$list filter="[<currentTiddler>prefix[Class Log - ]] ">
<$button class="tc-btn-invisible">{{$:/core/images/new-journal-button}}
      <$action-sendmessage $message="tm-new-tiddler" title=<<Title>> tags=<<newtags>> />
   </$button>
</$list>

Op vrijdag 8 januari 2021 om 07:14:31 UTC+1 schreef Sapphireslinger:

Sapphireslinger

unread,
Jan 8, 2021, 2:58:15 AM1/8/21
to TiddlyWiki
Thank you so much! Hope this teaches me to wikify from now on!

I made a tiddler titled $:/core/ui/Buttons/new-class-log-entry-here and put your code in it:

\define newtags() [[$(currentTiddler)$]] [[bible study session]]

<$wikify name="Title" text="""<<now "YYYY.0MM.0DD.0hh0mm " >><<currentTiddler>>""">

<$button class="tc-btn-invisible">{{$:/core/images/new-journal-button}}
      <$action-sendmessage $message="tm-new-tiddler" title=<<Title>> tags=<<newtags>> />
   </$button>


Notes:

* I removed the list filter because the icon wouldn't show up when viewing a "preview" of tiddlers containing the icon in the sidebar.
* However when I put {{Class Log - Jane Doe||$:/core/ui/Buttons/new-class-log-entry-here}} in the appropriate tiddler the icon is both viewable and clickable when that tiddler shows up in the sidebar. I have a finite number of students, so it is not too onerous to do this for each student.

Reply all
Reply to author
Forward
0 new messages