-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the testcase widget for $action-createtiddler examples (#8232)
* Use the testcase widget for the $action-createtiddler widget examples * Use procedure instead of macros for $action-createtiddler examples
- Loading branch information
Showing
7 changed files
with
65 additions
and
131 deletions.
There are no files selected for viewing
25 changes: 7 additions & 18 deletions
25
editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 1.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,15 @@ | ||
created: 20200131142401129 | ||
modified: 20211113230406823 | ||
modified: 20240602154417754 | ||
tags: ActionCreateTiddlerWidget | ||
title: ActionCreateTiddlerWidget Example 1 | ||
type: text/vnd.tiddlywiki | ||
|
||
\define testCreate() | ||
<$action-createtiddler /> | ||
\end | ||
|
||
This example will create "New Tiddler", "New Tiddler 1", " New Tiddler 2" and so on | ||
|
||
``` | ||
\define testCreate() | ||
<$action-createtiddler /> | ||
\end | ||
|
||
<$button actions=<<testCreate>> > | ||
Create Tiddler | ||
</$button> | ||
``` | ||
<$testcase> | ||
<$data title=Description text="Default widget with no attributes"/> | ||
<$data title=Narrative text='The button in this example uses the $action-createtiddler widget to create "New Tiddler", "New Tiddler 1", " New Tiddler 2" and so on'/> | ||
<$data title=Output text="""\procedure testCreate() <$action-createtiddler /> | ||
|
||
<$button actions=<<testCreate>> > | ||
<$action-setfield $tiddler="$:/state/tab/sidebar--595412856" text="$:/core/ui/SideBar/Recent"/> | ||
Create Tiddler | ||
</$button> - Clicking this button, will also open the Right sidebar: Recent tab | ||
</$button>"""/> | ||
</$testcase> |
26 changes: 9 additions & 17 deletions
26
editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 2.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,20 @@ | ||
created: 20200131144828713 | ||
modified: 20211113011036840 | ||
modified: 20240602160133371 | ||
tags: ActionCreateTiddlerWidget | ||
title: ActionCreateTiddlerWidget Example 2 | ||
type: text/vnd.tiddlywiki | ||
|
||
\define testCreate() | ||
<$action-createtiddler $basetitle={{$:/language/DefaultNewTiddlerTitle}} $overwrite="yes"/> | ||
\end | ||
|
||
This example will use the base title defined in [[$:/language/DefaultNewTiddlerTitle]]. | ||
|
||
It will overwrite the tiddler, if the button is clicked several times. | ||
<$testcase> | ||
<$data title=Description text="Transcluded base title"/> | ||
<$data title=Narrative text="""The $action-createtiddler widget in this example uses the base title defined in [[$:/language/DefaultNewTiddlerTitle]]. | ||
|
||
``` | ||
\define testCreate() | ||
It will overwrite the tiddler if the button is clicked several times."""/> | ||
<$data $tiddler="$:/language/DefaultNewTiddlerTitle"/> | ||
<$data title=Output text="""\procedure testCreate() | ||
<$action-createtiddler $basetitle={{$:/language/DefaultNewTiddlerTitle}} $overwrite="yes"/> | ||
\end | ||
|
||
<$button actions=<<testCreate>> > | ||
Create Tiddler | ||
</$button> | ||
``` | ||
|
||
<$button actions=<<testCreate>> > | ||
<$action-setfield $tiddler="$:/state/tab/sidebar--595412856" text="$:/core/ui/SideBar/Recent"/> | ||
Create Tiddler | ||
</$button> - Clicking this button, will also open the Right sidebar: Recent tab | ||
</$button>"""/> | ||
</$testcase> |
27 changes: 10 additions & 17 deletions
27
editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 3.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
created: 20200131145355658 | ||
modified: 20211113011111052 | ||
modified: 20240602155233116 | ||
tags: ActionCreateTiddlerWidget | ||
title: ActionCreateTiddlerWidget Example 3 | ||
type: text/vnd.tiddlywiki | ||
|
||
\define testCreate() | ||
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template"/> | ||
\end | ||
|
||
This example will uses a base-title and a template: [[ActionCreateTiddlerWidget Template]] | ||
|
||
It will create: "base", "base 1", "base 2" and so on | ||
<$testcase> | ||
<$data title=Description text="Template and custom base title"/> | ||
<$data title=Narrative text="""The $action-createtiddler widget in this example uses the basetitle attribute and template: [[ActionCreateTiddlerWidget Template]]. | ||
|
||
``` | ||
\define testCreate() | ||
Clicking the button will create: "base", "base 1", "base 2" and so on | ||
"""/> | ||
<$data $tiddler="ActionCreateTiddlerWidget Template"/> | ||
<$data title=Output text="""\procedure testCreate() | ||
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template"/> | ||
\end | ||
|
||
<$button actions=<<testCreate>> > | ||
Create Tiddler | ||
</$button> | ||
``` | ||
|
||
<$button actions=<<testCreate>> > | ||
<$action-setfield $tiddler="$:/state/tab/sidebar--595412856" text="$:/core/ui/SideBar/Recent"/> | ||
Create Tiddler | ||
</$button> - Clicking this button will also open the Right sidebar: Recent tab | ||
</$button>"""/> | ||
</$testcase> |
25 changes: 9 additions & 16 deletions
25
editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 4.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
created: 20200131150229551 | ||
modified: 20211113011129601 | ||
modified: 20240602154933113 | ||
tags: ActionCreateTiddlerWidget | ||
title: ActionCreateTiddlerWidget Example 4 | ||
type: text/vnd.tiddlywiki | ||
|
||
\define testCreate() | ||
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template" aa="new field aa" bb="new field bb" /> | ||
\end | ||
|
||
This example uses a base-title "base" and a template: [[ActionCreateTiddlerWidget Template]]. | ||
<$testcase> | ||
<$data title=Description text="Template with override fields and custom base title"/> | ||
<$data title=Narrative text="""The $action-createtiddler widget in this example uses the basetitle attribute and template: [[ActionCreateTiddlerWidget Template]]. | ||
|
||
There will be new fields "aa" and "bb" which are added to the new tiddlers. | ||
|
||
``` | ||
\define testCreate() | ||
"""/> | ||
<$data $tiddler="ActionCreateTiddlerWidget Template"/> | ||
<$data title=Output text="""\procedure testCreate() | ||
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template" aa="new field aa" bb="new field bb" /> | ||
\end | ||
|
||
<$button actions=<<testCreate>> > | ||
Create Tiddler | ||
</$button> | ||
``` | ||
|
||
<$button actions=<<testCreate>> > | ||
<$action-setfield $tiddler="$:/state/tab/sidebar--595412856" text="$:/core/ui/SideBar/Recent"/> | ||
Create Tiddler | ||
</$button> - Clicking this button will also open the Right sidebar: Recent tab | ||
</$button>"""/> | ||
</$testcase> |
30 changes: 9 additions & 21 deletions
30
editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget Example 5.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,20 @@ | ||
created: 20200131144828713 | ||
modified: 20230111220933412 | ||
modified: 20240602155008453 | ||
tags: ActionCreateTiddlerWidget | ||
title: ActionCreateTiddlerWidget Example 5 | ||
type: text/vnd.tiddlywiki | ||
|
||
\define testCreate() | ||
<$testcase> | ||
<$data title=Description text="Child action widget uses the created tiddler title"/> | ||
<$data title=Narrative text="""The $action-createtiddler widget in this example uses the <<.var createTiddler-title>> variable to navigate to the created tiddler"""/> | ||
<$data $tiddler="ActionCreateTiddlerWidget Template"/> | ||
<$data title=Output text="""\procedure testCreate() | ||
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template"> | ||
<$action-sendmessage $message="tm-edit-tiddler" $param=<<createTiddler-title>>/> | ||
<$action-navigate $to=<<createTiddler-title>>/> | ||
</$action-createtiddler> | ||
\end | ||
|
||
This example will use the base title defined in [[ActionCreateTiddlerWidget Template]]. | ||
|
||
It will create: "base", "base 1", "base 2" and so on, and navigate to this tiddler in draft mode. | ||
|
||
``` | ||
\define testCreate() | ||
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template"> | ||
<$action-sendmessage $message="tm-edit-tiddler" $param=<<createTiddler-title>>/> | ||
</$action-createtiddler> | ||
\end | ||
|
||
<$button actions=<<testCreate>> > | ||
Create Tiddler | ||
</$button> | ||
``` | ||
|
||
<$button actions=<<testCreate>> > | ||
<$action-setfield $tiddler="$:/state/tab/sidebar--595412856" text="$:/core/ui/SideBar/Recent"/> | ||
Create Tiddler | ||
</$button> - Clicking this button, will also open the Right sidebar: Recent tab | ||
</$button>"""/> | ||
</$testcase> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 17 additions & 7 deletions
24
editions/tw5.com/tiddlers/widgets/ActionCreateTiddlerWidget_Example.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
created: 20161020153426686 | ||
modified: 20211113011019510 | ||
modified: 20240602160452171 | ||
tags: ActionCreateTiddlerWidget | ||
title: ActionCreateTiddlerWidget Example | ||
type: text/vnd.tiddlywiki | ||
|
||
Caption for new button: <$edit-text tiddler="$:/state/new-button-caption" tag="input" default=""/> | ||
|
||
<$button> | ||
<$testcase> | ||
<$data title=Description text="Create a new page control button"/> | ||
<$data title=Narrative text="""Use the $action-createtiddler widget to create and open a new, non-functional page control button tiddler"""/> | ||
<$data title=Output text="""\procedure testCreate() | ||
<$action-createtiddler $basetitle="Homemade Button" tags="$:/tags/PageControls" text={{$:/state/new-button-caption}}> | ||
<$action-navigate $to=<<createTiddler-title>>/> | ||
<$action-navigate $to=<<createTiddler-title>>/> | ||
</$action-createtiddler> | ||
Create a new non-functional page control button and open the tiddler | ||
</$button> | ||
\end | ||
|
||
{{$:/core/ui/SideBarSegments/page-controls}} | ||
|
||
Caption for new button: <$edit-text tiddler="$:/state/new-button-caption" tag="input" default=""/> | ||
|
||
<$button actions=<<testCreate>> > | ||
Create Tiddler | ||
</$button>"""/> | ||
<$data title="$:/state/new-button-caption" text="button text "/> | ||
</$testcase> |