From dca626d2e8743dde7a5eab27ba635beca52af024 Mon Sep 17 00:00:00 2001 From: pmario Date: Fri, 19 Apr 2024 12:23:26 +0200 Subject: [PATCH 01/10] add a search button to the control panel tiddler fields tab --- core/wiki/allfields.tid | 42 ++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/core/wiki/allfields.tid b/core/wiki/allfields.tid index f148640d4c1..e38fda582f9 100644 --- a/core/wiki/allfields.tid +++ b/core/wiki/allfields.tid @@ -1,13 +1,41 @@ title: $:/snippets/allfields +\whitespace trim +\import [[$:/core/ui/ControlPanel/Basics]] + \define renderfield(title) -''<$text text=<<__title__>>/>''://{{$:/language/Docs/Fields/$title$}}// + + + ''<$text text=<<__title__>>/>'': + + + //<$text text={{$:/language/Docs/Fields/$title$}}/>// + + + <> + + \end -\whitespace trim + +\define renderfieldHeader() + + + ''Name'': + + + ''Description'' + + + ''Links'' + + +\end + - -<$list filter="[fields[]sort[title]]" variable="listItem"> -<$macrocall $name="renderfield" title=<>/> - - + + <> + <$list filter="[fields[]sort[title]]" variable="listItem"> + <$macrocall $name="renderfield" title=<>/> + +
From 3e8e79b7d2812c5e62609c3e8a7e538f98f3106c Mon Sep 17 00:00:00 2001 From: pmario Date: Sat, 20 Apr 2024 19:49:30 +0200 Subject: [PATCH 02/10] minor update --- core/wiki/allfields.tid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/wiki/allfields.tid b/core/wiki/allfields.tid index e38fda582f9..31574046f93 100644 --- a/core/wiki/allfields.tid +++ b/core/wiki/allfields.tid @@ -17,7 +17,7 @@ title: $:/snippets/allfields \end -\define renderfieldHeader() +\procedure renderfieldHeader() ''Name'': @@ -26,7 +26,7 @@ title: $:/snippets/allfields ''Description'' - ''Links'' + ''Show Links'' \end From 0347dbc18c353b4d88486d703b5abdde86dc375f Mon Sep 17 00:00:00 2001 From: pmario Date: Sun, 21 Apr 2024 10:42:12 +0200 Subject: [PATCH 03/10] use v5.3.x syntax --- core/ui/ControlPanel/Basics.tid | 12 ++++++------ core/wiki/allfields.tid | 11 +++++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/core/ui/ControlPanel/Basics.tid b/core/ui/ControlPanel/Basics.tid index b2ef2832a4a..0b023ccc62d 100644 --- a/core/ui/ControlPanel/Basics.tid +++ b/core/ui/ControlPanel/Basics.tid @@ -2,23 +2,23 @@ title: $:/core/ui/ControlPanel/Basics tags: $:/tags/ControlPanel/Info caption: {{$:/language/ControlPanel/Basics/Caption}} -\define lingo-base() $:/language/ControlPanel/Basics/ +\procedure lingo-base() $:/language/ControlPanel/Basics/ -\define show-filter-count(filter) \whitespace trim + +\procedure show-filter-count(filter) <$button class="tc-btn-invisible"> -<$action-setfield $tiddler="$:/temp/advancedsearch" $value="""$filter$"""/> -<$action-setfield $tiddler="$:/temp/advancedsearch/input" $value="""$filter$"""/> +<$action-setfield $tiddler="$:/temp/advancedsearch" $value=<>/> +<$action-setfield $tiddler="$:/temp/advancedsearch/input" $value=<>/> <$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/> <$action-setfield $tiddler="$:/state/tab--1498284803" $value="$:/core/ui/AdvancedSearch/Filter"/> <$action-navigate $to="$:/AdvancedSearch"/> <$action-sendmessage $message="tm-focus-selector" $param=".tc-advanced-search input"/> -''<$count filter="""$filter$"""/>'' +''<$count filter=<>/>'' {{$:/core/images/advanced-search-button}} \end -\whitespace trim |tc-max-width tc-edit-max-width|k |<> |''<>'' | diff --git a/core/wiki/allfields.tid b/core/wiki/allfields.tid index 31574046f93..d46881b6624 100644 --- a/core/wiki/allfields.tid +++ b/core/wiki/allfields.tid @@ -3,16 +3,19 @@ title: $:/snippets/allfields \whitespace trim \import [[$:/core/ui/ControlPanel/Basics]] -\define renderfield(title) +\function getLingoText() [[$:/language/Docs/Fields/]] [] +[join[]get[text]] + +\procedure renderfield(title) <tr class="tc-view-field"> <td class="tc-view-field-name"> - ''<$text text=<<__title__>>/>'': + ''<$text text=<<title>>/>'': </td> <td class="tc-view-field-value"> - //<$text text={{$:/language/Docs/Fields/$title$}}/>// + //<<getLingoText>>// </td> <td class="tc-view-field-links"> - <<show-filter-count "[has[$title$]sort[]]">> + <!-- show-filter-count expects a filter string. It does no more processing --> + <$macrocall $name="show-filter-count" filter=`[has[$(title)$]sort[]]`>> </td> </tr> \end From 9086b0ca7e91308e42a3d15de2ac6af9d1fb66fe Mon Sep 17 00:00:00 2001 From: pmario <pmariojo@gmail.com> Date: Sun, 21 Apr 2024 10:45:48 +0200 Subject: [PATCH 04/10] use tf. prefix for the function --- core/wiki/allfields.tid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/wiki/allfields.tid b/core/wiki/allfields.tid index d46881b6624..d871fa0201f 100644 --- a/core/wiki/allfields.tid +++ b/core/wiki/allfields.tid @@ -3,7 +3,7 @@ title: $:/snippets/allfields \whitespace trim \import [[$:/core/ui/ControlPanel/Basics]] -\function getLingoText() [[$:/language/Docs/Fields/]] [<title>] +[join[]get[text]] +\function tf.getLingoText() [[$:/language/Docs/Fields/]] [<title>] +[join[]get[text]] \procedure renderfield(title) <tr class="tc-view-field"> @@ -11,7 +11,7 @@ title: $:/snippets/allfields ''<$text text=<<title>>/>'': </td> <td class="tc-view-field-value"> - //<<getLingoText>>// + //<<tf.getLingoText>>// </td> <td class="tc-view-field-links"> <!-- show-filter-count expects a filter string. It does no more processing --> From 6c5be11deb06485ab2ec9819ed3f1b05af2d7db4 Mon Sep 17 00:00:00 2001 From: pmario <pmariojo@gmail.com> Date: Tue, 14 May 2024 08:27:30 +0200 Subject: [PATCH 05/10] make show-filter-count a global macro --- core/ui/ControlPanel/Basics.tid | 15 --------------- core/wiki/allfields.tid | 1 - core/wiki/macros/show-filter-count.tid | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 core/wiki/macros/show-filter-count.tid diff --git a/core/ui/ControlPanel/Basics.tid b/core/ui/ControlPanel/Basics.tid index 0b023ccc62d..bcdf2d6d057 100644 --- a/core/ui/ControlPanel/Basics.tid +++ b/core/ui/ControlPanel/Basics.tid @@ -3,23 +3,8 @@ tags: $:/tags/ControlPanel/Info caption: {{$:/language/ControlPanel/Basics/Caption}} \procedure lingo-base() $:/language/ControlPanel/Basics/ - \whitespace trim -\procedure show-filter-count(filter) -<$button class="tc-btn-invisible"> -<$action-setfield $tiddler="$:/temp/advancedsearch" $value=<<filter>>/> -<$action-setfield $tiddler="$:/temp/advancedsearch/input" $value=<<filter>>/> -<$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/> -<$action-setfield $tiddler="$:/state/tab--1498284803" $value="$:/core/ui/AdvancedSearch/Filter"/> -<$action-navigate $to="$:/AdvancedSearch"/> -<$action-sendmessage $message="tm-focus-selector" $param=".tc-advanced-search input"/> -''<$count filter=<<filter>>/>'' - -{{$:/core/images/advanced-search-button}} -</$button> -\end - |tc-max-width tc-edit-max-width|k |<<lingo Version/Prompt>> |''<<version>>'' | |<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> | diff --git a/core/wiki/allfields.tid b/core/wiki/allfields.tid index d871fa0201f..c7639d64867 100644 --- a/core/wiki/allfields.tid +++ b/core/wiki/allfields.tid @@ -1,7 +1,6 @@ title: $:/snippets/allfields \whitespace trim -\import [[$:/core/ui/ControlPanel/Basics]] \function tf.getLingoText() [[$:/language/Docs/Fields/]] [<title>] +[join[]get[text]] diff --git a/core/wiki/macros/show-filter-count.tid b/core/wiki/macros/show-filter-count.tid new file mode 100644 index 00000000000..6d9af2e77cc --- /dev/null +++ b/core/wiki/macros/show-filter-count.tid @@ -0,0 +1,16 @@ +title: $:/core/macros/show-filter-count +tags: $:/tags/Macro $:/tags/Global + +\procedure show-filter-count(filter) +<$button class="tc-btn-invisible"> +<$action-setfield $tiddler="$:/temp/advancedsearch" $value=<<filter>>/> +<$action-setfield $tiddler="$:/temp/advancedsearch/input" $value=<<filter>>/> +<$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/> +<$action-setfield $tiddler="$:/state/tab--1498284803" $value="$:/core/ui/AdvancedSearch/Filter"/> +<$action-navigate $to="$:/AdvancedSearch"/> +<$action-sendmessage $message="tm-focus-selector" $param=".tc-advanced-search input"/> +''<$count filter=<<filter>>/>'' + +{{$:/core/images/advanced-search-button}} +</$button> +\end \ No newline at end of file From 90ca46c76fabee3df6ba3b45733ccb62a1aa6bb1 Mon Sep 17 00:00:00 2001 From: pmario <pmariojo@gmail.com> Date: Sun, 4 Aug 2024 17:05:34 +0200 Subject: [PATCH 06/10] make table header translatable --- core/language/en-GB/Fields.multids | 3 +++ core/wiki/allfields.tid | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/language/en-GB/Fields.multids b/core/language/en-GB/Fields.multids index 68804f08234..8802c7f5304 100644 --- a/core/language/en-GB/Fields.multids +++ b/core/language/en-GB/Fields.multids @@ -1,5 +1,8 @@ title: $:/language/Docs/Fields/ +table-header-name-20240804162913000: Name +table-header-description-20240804162913000: Description +table-header-list-20240804162913000: Show List _canonical_uri: The full URI of an external image tiddler author: Name of the author of a plugin bag: The name of the bag from which a tiddler came diff --git a/core/wiki/allfields.tid b/core/wiki/allfields.tid index c7639d64867..bcfc69e06d4 100644 --- a/core/wiki/allfields.tid +++ b/core/wiki/allfields.tid @@ -2,7 +2,9 @@ title: $:/snippets/allfields \whitespace trim -\function tf.getLingoText() [[$:/language/Docs/Fields/]] [<title>] +[join[]get[text]] +\procedure lingo-base() $:/language/Docs/Fields/ + +\function tf.getLingoText() [<lingo-base>] [<title>] +[join[]get[text]] \procedure renderfield(title) <tr class="tc-view-field"> @@ -12,8 +14,8 @@ title: $:/snippets/allfields <td class="tc-view-field-value"> //<<tf.getLingoText>>// </td> - <td class="tc-view-field-links"> - <!-- show-filter-count expects a filter string. It does no more processing --> + <td class="tc-view-field-list"> + <!-- show-filter-count expects a filter string. It does no wikification --> <$macrocall $name="show-filter-count" filter=`[has[$(title)$]sort[]]`>> </td> </tr> @@ -22,13 +24,13 @@ title: $:/snippets/allfields \procedure renderfieldHeader() <tr class="tc-view-field"> <th class="tc-view-field-name"> - ''Name'': + ''<<lingo table-header-name-20240804162913000>>'': </th> <th class="tc-view-field-value"> - ''Description'' + ''<<lingo table-header-description-20240804162913000>>'' </th> - <th class="tc-view-field-links"> - ''Show Links'' + <th class="tc-view-field-list"> + ''<<lingo table-header-list-20240804162913000>>'' </th> </tr> \end From be1f7d419be286b1edf9b36d687a405aee7985e4 Mon Sep 17 00:00:00 2001 From: pmario <pmariojo@gmail.com> Date: Sun, 4 Aug 2024 17:06:07 +0200 Subject: [PATCH 07/10] add documentation --- .../tiddlers/macros/show-filter-count.tid | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 editions/tw5.com/tiddlers/macros/show-filter-count.tid diff --git a/editions/tw5.com/tiddlers/macros/show-filter-count.tid b/editions/tw5.com/tiddlers/macros/show-filter-count.tid new file mode 100644 index 00000000000..89f5286f1b0 --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/show-filter-count.tid @@ -0,0 +1,21 @@ +caption: colour +created: 20240804143842924 +modified: 20240804150223291 +tags: Macros [[Core Macros]] +title: show-filter-count Macro +type: text/vnd.tiddlywiki + +<<.from-version "5.3.6">> -- The <<.def show-filter-count>> [[macro|Macros]] creates an element, that shows a counter and a button to open the provided filter string in $:/AdvancedSearch + +!! Parameters + +; filter +: Needs to be a valid [[filter run|Filters]] + +!! Examples + +<<wikitext-example-without-html src:"""<<show-filter-count filter:"[tag[HelloThere]]">> -- The number and the icon is click-able""">> + +<<wikitext-example-without-html src:"""<<show-filter-count filter:"[has[author]sort[]]">> -- The number and the icon is click-able""">> + +Also see: [[$:/core/ui/ControlPanel/TiddlerFields]] From eb30ea893b73c0d9ca16029d1baf67baf7d00b2f Mon Sep 17 00:00:00 2001 From: pmario <pmariojo@gmail.com> Date: Sun, 4 Aug 2024 17:06:27 +0200 Subject: [PATCH 08/10] show-filter-count code cleanup --- core/wiki/macros/show-filter-count.tid | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/core/wiki/macros/show-filter-count.tid b/core/wiki/macros/show-filter-count.tid index 6d9af2e77cc..be06fcde1f5 100644 --- a/core/wiki/macros/show-filter-count.tid +++ b/core/wiki/macros/show-filter-count.tid @@ -1,16 +1,17 @@ title: $:/core/macros/show-filter-count tags: $:/tags/Macro $:/tags/Global +\whitespace trim + \procedure show-filter-count(filter) <$button class="tc-btn-invisible"> -<$action-setfield $tiddler="$:/temp/advancedsearch" $value=<<filter>>/> -<$action-setfield $tiddler="$:/temp/advancedsearch/input" $value=<<filter>>/> -<$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/> -<$action-setfield $tiddler="$:/state/tab--1498284803" $value="$:/core/ui/AdvancedSearch/Filter"/> -<$action-navigate $to="$:/AdvancedSearch"/> -<$action-sendmessage $message="tm-focus-selector" $param=".tc-advanced-search input"/> -''<$count filter=<<filter>>/>'' - -{{$:/core/images/advanced-search-button}} + <$action-setfield $tiddler="$:/temp/advancedsearch" $value=<<filter>>/> + <$action-setfield $tiddler="$:/temp/advancedsearch/input" $value=<<filter>>/> + <$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/> + <$action-setfield $tiddler="$:/state/tab--1498284803" $value="$:/core/ui/AdvancedSearch/Filter"/> + <$action-navigate $to="$:/AdvancedSearch"/> + <$action-sendmessage $message="tm-focus-selector" $param=".tc-advanced-search input"/> + <span class="tc-small-gap-right">''<$count filter=<<filter>>/>''</span> + {{$:/core/images/advanced-search-button}} </$button> \end \ No newline at end of file From 043b3d60df9cc7135f6531f2fe953dd938a6e9d4 Mon Sep 17 00:00:00 2001 From: pmario <pmariojo@gmail.com> Date: Wed, 7 Aug 2024 22:28:58 +0200 Subject: [PATCH 09/10] remove the table-header --- core/language/en-GB/Fields.multids | 3 --- core/wiki/allfields.tid | 17 +---------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/core/language/en-GB/Fields.multids b/core/language/en-GB/Fields.multids index 8802c7f5304..68804f08234 100644 --- a/core/language/en-GB/Fields.multids +++ b/core/language/en-GB/Fields.multids @@ -1,8 +1,5 @@ title: $:/language/Docs/Fields/ -table-header-name-20240804162913000: Name -table-header-description-20240804162913000: Description -table-header-list-20240804162913000: Show List _canonical_uri: The full URI of an external image tiddler author: Name of the author of a plugin bag: The name of the bag from which a tiddler came diff --git a/core/wiki/allfields.tid b/core/wiki/allfields.tid index bcfc69e06d4..8f59a317f17 100644 --- a/core/wiki/allfields.tid +++ b/core/wiki/allfields.tid @@ -15,29 +15,14 @@ title: $:/snippets/allfields //<<tf.getLingoText>>// </td> <td class="tc-view-field-list"> - <!-- show-filter-count expects a filter string. It does no wikification --> <$macrocall $name="show-filter-count" filter=`[has[$(title)$]sort[]]`>> </td> </tr> \end -\procedure renderfieldHeader() -<tr class="tc-view-field"> - <th class="tc-view-field-name"> - ''<<lingo table-header-name-20240804162913000>>'': - </th> - <th class="tc-view-field-value"> - ''<<lingo table-header-description-20240804162913000>>'' - </th> - <th class="tc-view-field-list"> - ''<<lingo table-header-list-20240804162913000>>'' - </th> -</tr> -\end - <table class="tc-view-field-table"> <tbody> - <<renderfieldHeader>> + <!-- <<renderfieldHeader>> --> <$list filter="[fields[]sort[title]]" variable="listItem"> <$macrocall $name="renderfield" title=<<listItem>>/> </$list> From b9be6dc071a5efcb23a8089d255d686d8c99287d Mon Sep 17 00:00:00 2001 From: pmario <pmariojo@gmail.com> Date: Fri, 9 Aug 2024 09:56:00 +0200 Subject: [PATCH 10/10] remove erroneous caption field --- editions/tw5.com/tiddlers/macros/show-filter-count.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlers/macros/show-filter-count.tid b/editions/tw5.com/tiddlers/macros/show-filter-count.tid index 89f5286f1b0..7e026a5906b 100644 --- a/editions/tw5.com/tiddlers/macros/show-filter-count.tid +++ b/editions/tw5.com/tiddlers/macros/show-filter-count.tid @@ -1,4 +1,4 @@ -caption: colour + created: 20240804143842924 modified: 20240804150223291 tags: Macros [[Core Macros]]