1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-29 23:40:45 +00:00

Refactor to use global procedures to control the tour

This commit is contained in:
Jeremy Ruston 2023-09-10 11:28:23 +01:00
parent d28cf74115
commit c9d8806682
4 changed files with 19 additions and 9 deletions

View File

@ -1,8 +1,23 @@
title: $:/plugins/tiddlywiki/tour/globals
tags: $:/tags/Global
\procedure tour-initialise-current-tour-step()
<$transclude $tiddler={{$:/state/tour/step}} $field="startup-actions"/>
\end
\procedure tour-restart()
<$action-setfield $tiddler="$:/config/ShowTour" text="show"/>
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]first[]] }}}/>
{{$:/plugins/tiddlywiki/tour/actions/initialise-current-tour-step}}
<<tour-initialise-current-tour-step>>
\end
\procedure tour-next-step()
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]after{$:/state/tour/step}else[$:/plugins/tiddlywiki/tour/steps/finished]] }}}/>
<<tour-initialise-current-tour-step>>
\end
\procedure tour-previous-step()
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]before{$:/state/tour/step}] :else[all[shadows+tiddlers]tag[$:/tags/TourStep]first[]] }}}/>
<<tour-initialise-current-tour-step>>
\end

View File

@ -1,3 +0,0 @@
title: $:/plugins/tiddlywiki/tour/actions/initialise-current-tour-step
<$transclude $tiddler={{$:/state/tour/step}} $field="startup-actions"/>

View File

@ -1,4 +1,4 @@
title: $:/plugins/tiddlywiki/tour/startup-actions
tags: $:/tags/StartupAction
{{$:/plugins/tiddlywiki/tour/actions/initialise-current-tour-step}}
<<tour-restart>>

View File

@ -6,14 +6,12 @@ tags: $:/tags/PageTemplate
<div class="tc-tour-panel-navigation">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TourStep]before{$:/state/tour/step}count[]compare:number:gt[0]]" variable="ignore">
<$button class="tc-btn-big-green" style="background-color: red;">
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]before{$:/state/tour/step}] :else[all[shadows+tiddlers]tag[$:/tags/TourStep]first[]] }}}/>
{{$:/plugins/tiddlywiki/tour/actions/initialise-current-tour-step}}
<<tour-previous-step>>
back
</$button>
</$list>
<$button class="tc-btn-big-green" style="background-color: purple;">
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag[$:/tags/TourStep]after{$:/state/tour/step}else[$:/plugins/tiddlywiki/tour/steps/finished]] }}}/>
{{$:/plugins/tiddlywiki/tour/actions/initialise-current-tour-step}}
<<tour-next-step>>
next
</$button>
</div>