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

Commit 3c01ace

Browse files
committed
Fix: Have loading message adapt
1 parent d9400f8 commit 3c01ace

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

runestone/selectquestion/selectone.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
TEMPLATE = """
5050
<div class="runestone alert alert-warning sqcontainer">
5151
<div data-component="selectquestion" id={component_id} {selector} {points} {proficiency} {min_difficulty} {max_difficulty} {autogradable} {not_seen_ever} {primary} {AB} {toggle_options} {toggle_labels}>
52-
<p>Loading ...</p>
52+
<p>{message}</p>
5353
</div>
5454
</div>
5555
"""
@@ -109,25 +109,28 @@ def run(self):
109109
addQuestionToDB(self)
110110
env = self.state.document.settings.env
111111
is_dynamic = env.config.html_context.get("dynamic_pages", False)
112+
is_preview = env.config.html_context.get("course_id", None) == "preview"
112113

113114
if not (bool("fromid" in self.options) ^ bool("proficiency" in self.options)):
114115
raise self.severe(
115116
"You must specify either fromid or proficiency but not both"
116117
)
117118

118-
if is_dynamic:
119-
self.options["message"] = "Loading ..."
119+
if is_dynamic or is_preview:
120+
self.options["message"] = "Loading a dynamic question ..."
120121
else:
121122
self.options[
122123
"message"
123-
] = "The selectquestion directive only works with dynamic pages"
124+
] = "The selectquestion directive only works with Runestone Services"
124125

125126
if "fromid" in self.options:
126127
self.question_bank_choices = self.options["fromid"]
127128
self.options[
128129
"selector"
129130
] = f"data-questionlist='{self.question_bank_choices}'"
130-
self.options["message"] += f"\nSelecting from: {self.question_bank_choices}"
131+
self.options[
132+
"message"
133+
] += f"<br/>Selecting from: {self.question_bank_choices}"
131134
else:
132135
self.options["selector"] = ""
133136

0 commit comments

Comments
 (0)