mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-14 05:44:50 +00:00
Add a search button to the control panel tiddler fields tab (#8157)
* add a search button to the control panel tiddler fields tab * minor update * use v5.3.x syntax * use tf. prefix for the function * make show-filter-count a global macro * make table header translatable * add documentation * show-filter-count code cleanup * remove the table-header * remove erroneous caption field
This commit is contained in:
parent
d7b00a6dd0
commit
4f4e055091
@ -2,22 +2,7 @@ title: $:/core/ui/ControlPanel/Basics
|
|||||||
tags: $:/tags/ControlPanel/Info
|
tags: $:/tags/ControlPanel/Info
|
||||||
caption: {{$:/language/ControlPanel/Basics/Caption}}
|
caption: {{$:/language/ControlPanel/Basics/Caption}}
|
||||||
|
|
||||||
\define lingo-base() $:/language/ControlPanel/Basics/
|
\procedure lingo-base() $:/language/ControlPanel/Basics/
|
||||||
|
|
||||||
\define show-filter-count(filter)
|
|
||||||
\whitespace trim
|
|
||||||
<$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
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
|tc-max-width tc-edit-max-width|k
|
|tc-max-width tc-edit-max-width|k
|
||||||
|
@ -1,13 +1,30 @@
|
|||||||
title: $:/snippets/allfields
|
title: $:/snippets/allfields
|
||||||
|
|
||||||
\define renderfield(title)
|
|
||||||
<tr class="tc-view-field"><td class="tc-view-field-name">''<$text text=<<__title__>>/>'':</td><td class="tc-view-field-value">//{{$:/language/Docs/Fields/$title$}}//</td></tr>
|
|
||||||
\end
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
|
\procedure lingo-base() $:/language/Docs/Fields/
|
||||||
|
|
||||||
|
\function tf.getLingoText() [<lingo-base>] [<title>] +[join[]get[text]]
|
||||||
|
|
||||||
|
\procedure renderfield(title)
|
||||||
|
<tr class="tc-view-field">
|
||||||
|
<td class="tc-view-field-name">
|
||||||
|
''<$text text=<<title>>/>'':
|
||||||
|
</td>
|
||||||
|
<td class="tc-view-field-value">
|
||||||
|
//<<tf.getLingoText>>//
|
||||||
|
</td>
|
||||||
|
<td class="tc-view-field-list">
|
||||||
|
<$macrocall $name="show-filter-count" filter=`[has[$(title)$]sort[]]`>>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
\end
|
||||||
|
|
||||||
<table class="tc-view-field-table">
|
<table class="tc-view-field-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<$list filter="[fields[]sort[title]]" variable="listItem">
|
<!-- <<renderfieldHeader>> -->
|
||||||
<$macrocall $name="renderfield" title=<<listItem>>/>
|
<$list filter="[fields[]sort[title]]" variable="listItem">
|
||||||
</$list>
|
<$macrocall $name="renderfield" title=<<listItem>>/>
|
||||||
</tbody>
|
</$list>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
17
core/wiki/macros/show-filter-count.tid
Normal file
17
core/wiki/macros/show-filter-count.tid
Normal file
@ -0,0 +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"/>
|
||||||
|
<span class="tc-small-gap-right">''<$count filter=<<filter>>/>''</span>
|
||||||
|
{{$:/core/images/advanced-search-button}}
|
||||||
|
</$button>
|
||||||
|
\end
|
21
editions/tw5.com/tiddlers/macros/show-filter-count.tid
Normal file
21
editions/tw5.com/tiddlers/macros/show-filter-count.tid
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
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]]
|
Loading…
Reference in New Issue
Block a user