From 00cdd04edd49c2bf0e461071c0c7c50f8aab4e42 Mon Sep 17 00:00:00 2001 From: Simon Baird Date: Fri, 10 Oct 2014 00:35:17 +1000 Subject: [PATCH] Add a 'new journal here' button The journal tiddler will be tagged with the name of the current tiddler. This is similar to how the new here button works. (Would have liked to reuse the journalButton code which is almost identical between new-journal-here and new-journal, but I'm not sure how to do it.) --- core/language/en-GB/Buttons.multids | 2 ++ core/ui/PageControls/new-journal-here.tid | 21 +++++++++++++++++++++ core/ui/PageControls/new-journal.tid | 5 +++-- core/wiki/config/ViewToolbarButtons.multids | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 core/ui/PageControls/new-journal-here.tid diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 6cee87661..2888f4768 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -40,6 +40,8 @@ NewHere/Caption: new here NewHere/Hint: Create a new tiddler tagged with this one NewJournal/Caption: new journal NewJournal/Hint: Create a new journal tiddler +NewJournalHere/Caption: new journal here +NewJournalHere/Hint: Create a new journal tiddler tagged with this one NewTiddler/Caption: new tiddler NewTiddler/Hint: Create a new tiddler Permalink/Caption: permalink diff --git a/core/ui/PageControls/new-journal-here.tid b/core/ui/PageControls/new-journal-here.tid new file mode 100644 index 000000000..9903b22fe --- /dev/null +++ b/core/ui/PageControls/new-journal-here.tid @@ -0,0 +1,21 @@ +title: $:/core/ui/Buttons/new-journal-here +tags: $:/tags/ViewToolbar +caption: {{$:/core/images/new-journal-button}} {{$:/language/Buttons/NewJournalHere/Caption}} +description: {{$:/language/Buttons/NewJournalHere/Hint}} + +\define journalButton() +<$button tooltip={{$:/language/Buttons/NewJournalHere/Hint}} aria-label={{$:/language/Buttons/NewJournalHere/Caption}} class=<>> +<$action-sendmessage $message="tm-new-tiddler" title=<> tags="[[$(currentTiddlerTag)$]] $(journalTags)$"/> +<$list filter="[prefix[yes]]"> +{{$:/core/images/new-journal-button}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/NewJournalHere/Caption}}/> + + +\end +<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}> +<$set name="journalTags" value={{$:/config/NewJournal/Tags}}> +<$set name="currentTiddlerTag" value=<>> +<> + diff --git a/core/ui/PageControls/new-journal.tid b/core/ui/PageControls/new-journal.tid index cfb90bd29..6177c96a8 100644 --- a/core/ui/PageControls/new-journal.tid +++ b/core/ui/PageControls/new-journal.tid @@ -5,7 +5,7 @@ description: {{$:/language/Buttons/NewJournal/Hint}} \define journalButton() <$button tooltip={{$:/language/Buttons/NewJournal/Hint}} aria-label={{$:/language/Buttons/NewJournal/Caption}} class=<>> -<$action-sendmessage $message="tm-new-tiddler" title=<> tags={{$:/config/NewJournal/Tags}}/> +<$action-sendmessage $message="tm-new-tiddler" title=<> tags="$(journalTags)$"/> <$list filter="[prefix[yes]]"> {{$:/core/images/new-journal-button}} @@ -15,5 +15,6 @@ description: {{$:/language/Buttons/NewJournal/Hint}} \end <$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}> +<$set name="journalTags" value={{$:/config/NewJournal/Tags}}> <> - + diff --git a/core/wiki/config/ViewToolbarButtons.multids b/core/wiki/config/ViewToolbarButtons.multids index 15d55bd41..84d8028e3 100644 --- a/core/wiki/config/ViewToolbarButtons.multids +++ b/core/wiki/config/ViewToolbarButtons.multids @@ -4,5 +4,6 @@ core/ui/Buttons/clone: hide core/ui/Buttons/close-others: hide core/ui/Buttons/more-tiddler-actions: hide core/ui/Buttons/new-here: hide +core/ui/Buttons/new-journal-here: hide core/ui/Buttons/permalink: hide core/ui/Buttons/permaview: hide