1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-05 21:33:52 +00:00

wip toc testcase make new child button work

This commit is contained in:
pmario 2024-07-31 06:50:59 +02:00
parent f8954965ec
commit 4d66f95857
4 changed files with 98 additions and 75 deletions

View File

@ -3,6 +3,7 @@ code-body: yes
\whitespace trim
\procedure linkcatcherActions()
<$action-log/>
<%if [<navigateTo>has[title]] %>
<$qualify title=<<state>> name="qualifiedState">
<$action-setfield $tiddler=<<qualifiedState>> text=<<navigateTo>>/>
@ -10,9 +11,11 @@ code-body: yes
<%endif%>
\end
<$navigator story={{{ [<qualify $:/StoryList/>] }}} history={{{ [<qualify $:/HistoryList/>] }}}>
<$let
state={{{ [<qualify "$:/state/testcase">] }}}
>
<$linkcatcher actions=<<linkcatcherActions>>>
<div class="tc-test-case-wrapper">
<div class="tc-test-case-header">
<h2>
@ -72,7 +75,7 @@ code-body: yes
<%endif%>
<div class="tc-test-case-panes">
<div class="tc-test-case-source">
<$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -Description -Narrative -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/>
<$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -[prefix[$:/HistoryList/]] -[prefix[$:/StoryList/]] -Description -Narrative -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/>
</div>
<div class="tc-test-case-divider">
</div>
@ -80,13 +83,13 @@ code-body: yes
<%if [<displayFormat>!match[]else[wikitext]match[plaintext]] %>
<pre><$view tiddler="Output" format="plainwikified" mode="block"/></pre>
<%else%>
<$linkcatcher actions=<<linkcatcherActions>>>
<$tiddler tiddler="Output">
<$transclude $tiddler="Output" $mode="block"/>
</$tiddler>
</$linkcatcher>
<%endif%>
</div>
</div>
</div>
</$linkcatcher>
</$let>
</$navigator>

View File

@ -1,6 +1,19 @@
title: $:/core/ui/testcases/DefaultTemplate/SourceTabs
\whitespace trim
\procedure saveActions()
<$action-log/>
<$action-sendmessage $message="tm-save-tiddler" $param=<<title>> />
<$action-navigate $to=<<navTitle>> $scroll="no"/>
\end
\procedure saveButton(title, navTitle)
<$button class="tc-btn-invisible tc-test-case-save-button tc-small-gap-left" actions=<<saveActions>> >
{{$:/core/images/done-button}}
</$button>
\end
\procedure body()
<$list filter="[<currentTab>fields[]] -text +[limit[1]]" variable="ignore">
<table class="tc-field-table">
@ -11,7 +24,12 @@ title: $:/core/ui/testcases/DefaultTemplate/SourceTabs
<$text text=<<fieldName>>/>
</td>
<td>
<%if [<fieldName>match[draft.title]] :filter[<currentTab>has[draft.of]] %>
<$edit class="tc-edit-texteditor tc-max-width-80" tiddler=<<currentTab>> field=<<fieldName>>/>
<$macrocall $name="saveButton" navTitle={{{ [<currentTab>get[draft.title]] }}} title=<<currentTab>>/>
<%else%>
<$view tiddler=<<currentTab>> field=<<fieldName>>/>
<%endif%>
</td>
</tr>
</$list>

View File

@ -54,6 +54,8 @@ The very first toc macro is _not_ reused. So it can be used as a simple referenc
<$action-sendmessage $message="tm-new-tiddler" $name=<<field>> $value={{{[<currentTiddler>format:titlelist[]]}}}/>
{{$:/core/images/new-here-button}}
<% endif %>
<!-- Allows the toc macros to navigate in test-case tiddlers -->
<$action-navigate $to={{{ [<tv-history-list>get[current-tiddler]] }}}/>
</$button>
\end _newChild
<% if [<tv-toc-show-new-child>match[yes]] %>

View File

@ -1,6 +1,6 @@
created: 20240730081443212
description: Simple TOC - parentField parameter
modified: 20240730090835300
modified: 20240730115536164
tags: $:/tags/wiki-test-spec
title: Examples/TOC/SimpleToc/parentField
type: text/vnd.tiddlywiki-multiple
@ -44,7 +44,7 @@ title: Output
This variable set to yes allows you to show a New-Child button.
This button will create a "real" tiddler, which will _not_ be listed here
-->
\define tv-toc-show-new-child() no
\define tv-toc-show-new-child() yes
<div class="tc-table-of-contents">
<<toc tag:"root" parentField:"parent">>