Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit 73d10f3

Browse files
committed
Fix: dashboard links for PreTeXt books
1 parent b25301e commit 73d10f3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

controllers/dashboard.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ def index():
124124
chapters = db(db.chapters.course_id == course.base_course).select(
125125
orderby=db.chapters.chapter_num
126126
)
127+
c_origin = getCourseOrigin(course.base_course)
128+
if c_origin and c_origin.value == "PreTeXt":
129+
c_origin = "PreTeXt"
130+
else:
131+
c_origin = "Runestone"
127132

128133
logger.debug("getting chapters for {}".format(auth.user.course_name))
129134
chapget = ChapterGet(chapters)
@@ -320,6 +325,7 @@ def index():
320325
studentactivity=studentactivity,
321326
recentactivity=recentactivity,
322327
dailyactivity=dailyactivity,
328+
origin=c_origin,
323329
)
324330

325331

views/dashboard/index.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ <h1>
5151
{{ for section in sections: }}
5252
{{ sectionnumber=section["number"] }}
5353
<div style="height: 30px;">
54-
<div style="font-size:1.0em; font-weight: bold; margin-top: 0.5em;"><a style="color:black;" href="{{=get_course_url(selected_chapter['chapter_label'], section['text'])}}.html">{{=section["name"]}}</a></div>
54+
<div style="font-size:1.0em; font-weight: bold; margin-top: 0.5em;">
55+
{{ if origin == "Runestone":}}
56+
<a style="color:black;" href="{{=get_course_url(selected_chapter['chapter_label'], section['text'])}}.html">{{=section["name"]}}</a>
57+
{{ else: }}
58+
<a style="color:black;" href="{{=get_course_url("", section['text'])}}.html">{{=section["name"]}}</a>
59+
60+
{{ pass }}
61+
62+
</div>
63+
5564
<div style="" class="dash-bar-container">
5665
<div class="dash-bar dash-bar-correct" style="width: {{=section['readPercent']}};"> {{=section["readPercent"]}}&nbsp;</div>
5766
<div class="dash-bar dash-bar-attempts" style=" width: {{=section['startedPercent']}};"> {{=section["startedPercent"]}}&nbsp;</div>

0 commit comments

Comments
 (0)