From b75fa58746a0dc283a90d3f4288c67976a97fd37 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Tue, 20 Aug 2024 17:29:16 +0200 Subject: [PATCH] Testcase widget improve containment (#8529) * testcase improve containment using navigator-widget * testcase implement minimal edit new-tiddler interface --- core/ui/TestCases/DefaultTemplate.tid | 23 ++++++++++++------- .../TestCases/DefaultTemplateSourceTabs.tid | 23 ++++++++++++++++++- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/core/ui/TestCases/DefaultTemplate.tid b/core/ui/TestCases/DefaultTemplate.tid index 39c6bab52..2967a5157 100644 --- a/core/ui/TestCases/DefaultTemplate.tid +++ b/core/ui/TestCases/DefaultTemplate.tid @@ -3,7 +3,7 @@ code-body: yes \whitespace trim -\function tf.state() [] +\function tf.state() "$:/state/testcase" \procedure linkcatcherActions() <%if [has[title]] %> @@ -102,9 +102,12 @@ code-body: yes [all[tiddlers]sort[]] Output +[putfirst[]] -Description -Narrative +-[[$:/temp/testcase/draft-title]] -[has[plugin-type]] -[prefix] -[prefix[$:/state/popup/export]] +-[prefix[$:/HistoryList]] +-[prefix[$:/StoryList]] \end \procedure testcase-source() @@ -129,13 +132,17 @@ code-body: yes \procedure testcase-body()
<> - <%if [[Narrative]is[tiddler]] %> - <> - <%endif%> - <%if [match[fail]] %> - <> - <%endif%> - <> + <$let testcase-source-state = <>> + <$navigator story="$:/StoryList" history="$:/HistoryList"> + <%if [[Narrative]is[tiddler]] %> + <> + <%endif%> + <%if [match[fail]] %> + <> + <%endif%> + <> + +
\end diff --git a/core/ui/TestCases/DefaultTemplateSourceTabs.tid b/core/ui/TestCases/DefaultTemplateSourceTabs.tid index 862a7f57a..77532a3b7 100644 --- a/core/ui/TestCases/DefaultTemplateSourceTabs.tid +++ b/core/ui/TestCases/DefaultTemplateSourceTabs.tid @@ -1,6 +1,22 @@ title: $:/core/ui/testcases/DefaultTemplate/SourceTabs \whitespace trim + +\procedure testcaseNewTitle() $:/temp/testcase/draft-title + +\procedure saveActions() +<$action-setfield $tiddler=<> $field="draft.title" $value=<>/> +<$action-sendmessage $message="tm-save-tiddler" $param=<> /> +<$action-setfield $tiddler=<<testcase-source-state>> text=<<newTitle>>/> +<$action-deletetiddler $tiddler=<<testcaseNewTitle>>/> +\end + +\procedure saveButton(title, newTitle) +<$button class="tc-btn-invisible tc-test-case-save-button tc-small-gap-left" actions=<<saveActions>> disabled={{{ [<testcaseNewTitle>!has[text]then[yes]] }}}> +{{$:/core/images/done-button}} +</$button> +\end + \procedure body() <$list filter="[<currentTab>fields[]] -text +[limit[1]]" variable="ignore"> <table class="tc-field-table"> @@ -11,7 +27,12 @@ title: $:/core/ui/testcases/DefaultTemplate/SourceTabs <$text text=<<fieldName>>/> </td> <td> - <$view tiddler=<<currentTab>> field=<<fieldName>>/> + <%if [<fieldName>match[draft.title]] %> + <$edit-text class="tc-edit-texteditor tc-max-width-80" tiddler=<<testcaseNewTitle>> focus="yes" tag="input"/> + <$macrocall $name="saveButton" newTitle={{{ [<testcaseNewTitle>get[text]] }}} title=<<currentTab>>/> + <%else%> + <$view tiddler=<<currentTab>> field=<<fieldName>>/> + <%endif%> </td> </tr> </$list>