@@ -23,11 +23,11 @@ func update_breadcrumbs(course_index: CourseIndex, target: BBCodeParser.ParseNod
2323
2424
2525func _rebuild_breadcrumbs () -> void :
26+ _clear_navigation_nodes ()
27+
2628 if not _last_course_index or not _last_target :
2729 return
2830
29- _clear_navigation_nodes ()
30-
3131 if _last_target is BBCodeParser .ParseNode and _last_target .tag == BBCodeParserData .Tag .LESSON :
3232 var lesson := _last_target as BBCodeParser .ParseNode
3333 var lesson_index := - 1
@@ -46,23 +46,22 @@ func _rebuild_breadcrumbs() -> void:
4646 if lesson_index >= 0 :
4747 node_text = "%s . %s " % [lesson_index + 1 , tr (title )]
4848
49- _create_navigation_node (node_text , "" , true )
49+ _create_navigation_node (node_text , null , "" , true )
5050 return
5151
52- if _last_target is BBCodeParser .ParseNode and _last_target .tag == BBCodeParserData .Tag .PRACTICE :
52+ elif _last_target is BBCodeParser .ParseNode and _last_target .tag == BBCodeParserData .Tag .PRACTICE :
5353 var practice := _last_target as BBCodeParser .ParseNode
5454 # TODO: Should probably avoid relying on content ID for getting paths.
55+
5556 var practice_id := BBCodeUtils .get_practice_id (practice )
56- var lesson_path = practice_id .get_base_dir ().path_join ("lesson.bbcode" )
5757
58- var lesson : BBCodeParser .ParseNode
58+ var lesson : BBCodeParser .ParseNode = practice . parent
5959 var lesson_index := - 1
6060
6161 var i := 0
6262 for l in _last_course_index .get_lessons_count ():
6363 var lesson_data := NavigationManager .get_navigation_resource (_last_course_index .get_lesson_path (l )) as BBCodeParser .ParseNode
64- if lesson_data .bbcode_path == lesson_path :
65- lesson = lesson_data
64+ if lesson_data .bbcode_path == lesson .bbcode_path :
6665 lesson_index = i
6766 break
6867
@@ -71,7 +70,7 @@ func _rebuild_breadcrumbs() -> void:
7170 if lesson and lesson_index >= 0 :
7271 var title := BBCodeUtils .get_lesson_title (lesson )
7372 var lesson_text := "%d . %s " % [lesson_index + 1 , tr (title )]
74- _create_navigation_node (lesson_text , lesson .bbcode_path )
73+ _create_navigation_node (lesson_text , _last_course_index , lesson .bbcode_path )
7574
7675 var practice_count := BBCodeUtils .get_lesson_practice_count (lesson )
7776 var practice_index := - 1
@@ -83,7 +82,7 @@ func _rebuild_breadcrumbs() -> void:
8382 break
8483 var practice_title := BBCodeUtils .get_practice_title (practice )
8584 var node_text : String = "%d . %s " % [practice_index + 1 , tr (practice_title )]
86- _create_navigation_node (node_text , "" , true )
85+ _create_navigation_node (node_text , null , "" , true )
8786 return
8887
8988
@@ -93,7 +92,7 @@ func _clear_navigation_nodes() -> void:
9392 child_node .queue_free ()
9493
9594
96- func _create_navigation_node (text : String , path : String = "" , current : bool = false ) -> void :
95+ func _create_navigation_node (text : String , course_index : CourseIndex , path : String = "" , current : bool = false ) -> void :
9796 if get_child_count () > 0 :
9897 var separator := Label .new ()
9998 separator .text = "•"
@@ -117,7 +116,8 @@ func _create_navigation_node(text: String, path: String = "", current: bool = fa
117116 navigation_node .add_theme_font_size_override ("font_size" , NODE_FONT_SIZE )
118117 navigation_node .mouse_default_cursor_shape = CURSOR_POINTING_HAND
119118 add_child (navigation_node )
120- navigation_node .pressed .connect (_on_navigation_pressed .bind (path ))
119+ var slug := "#%s /%s " % [course_index .get_course_id (), course_index .get_lesson_slug_from_path (path )]
120+ navigation_node .pressed .connect (_on_navigation_pressed .bind (slug ))
121121
122122
123123func _on_navigation_pressed (path : String ) -> void :
0 commit comments