Skip to content

Commit d281c3d

Browse files
committed
Changed GotoPane to work with links to other maps (wip)
1 parent 4841329 commit d281c3d

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

Tutorial-o-Matic/src/main/groovy/ToM.groovy

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class ToM{
123123
addTOCPane(myPanel, tutNode)
124124
break
125125
case styles.goto:
126-
addGotoPane(myPanel, tutNode.children, nextTutNodes[0], options)
126+
addGotoPane(myPanel, tutNode, nextTutNodes[0], options)
127127
break
128128
case styles.action:
129129
addActionPane(myPanel, tutNode, options)
@@ -283,23 +283,38 @@ class ToM{
283283
}
284284
}
285285

286-
def static addGotoPane(myP, nodos, backNode, options){
286+
def static addGotoPane(myP, ApiNode tNode, ApiNode backNode, options){
287+
backNode = withGoBack(tNode)?backNode:null
288+
def nodos = tNode.children
287289
nodos.findAll{n -> n.link.node?true:false}.each{nodo ->
288290
def targetNode = nodo.link.node
289291
def msgHtml = nodo.note?tomui.getHtmlFromNote(nodo, options):null
290292
def bttnText = nodo.text
291293
def bttnToolTip = "Click to go to '${bttnText}' section"
292-
def bttnAction = { e -> gotoAction(myP, targetNode, backNode) }
293-
def buttonPanel = tomui.createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
294+
def bttnAction = { e ->
295+
if(targetNode.style.name == styles.tutorial){
296+
def tutorialTabName = targetNode[attributeTabLabel] ?: defaultTabLabel
297+
def myP_thisTutorial = tomui.getContentPaneFromMyTab(tutorialTabName.toString(), true)
298+
gotoAction(myP_thisTutorial, targetNode, null)
299+
} else {
300+
gotoAction(myP, targetNode, backNode)
301+
}
302+
}
303+
def buttonPanel = tomui.createButtonPanel(msgHtml, bttnText, bttnToolTip, bttnAction, false)
294304
myP.add(buttonPanel, tomui.GBC)
295305
}
296306
}
297307

308+
def static withGoBack( ApiNode nodo){
309+
def iconos = nodo.icons.icons
310+
return iconos.contains('emoji-1F519')
311+
}
312+
298313
def static gotoAction(myP, ApiNode targetNode, ApiNode backNode){
299314
myP.removeAll()
300-
addReturnPane(myP, backNode)
315+
if (backNode) addReturnPane(myP, backNode)
301316
fillPage(myP, targetNode, true, false)
302-
addReturnPane(myP, backNode)
317+
if (backNode) addReturnPane(myP, backNode)
303318
}
304319

305320
def static addReturnPane(myP, ApiNode backNode){

0 commit comments

Comments
 (0)