Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions runestone/assess/js/timed.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ Timed.prototype.init = function (opts) {
if ($(this.origElem).is("[data-no-timer]")) {
this.showTimer = false;
}
this.fullwidth = false;
if ($(this.origElem).is("[data-fullwidth]")) {
this.fullwidth = true;
}

this.running = 0;
this.paused = 0;
Expand Down Expand Up @@ -105,6 +109,13 @@ Timed.prototype.renderTimedAssess = function () {

Timed.prototype.renderContainer = function () {
this.assessDiv = document.createElement("div"); // container for the entire Timed Component

if (this.fullwidth) {
// allow the container to fill the width - barb
$(this.assessDiv).attr({
"style": "max-width:none"
});
}
this.assessDiv.id = this.divid;
this.timedDiv = document.createElement("div"); // div that will hold the questions for the timed assessment
this.navDiv = document.createElement("div"); // For navigation control
Expand Down
9 changes: 8 additions & 1 deletion runestone/assess/timedassessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def visit_timed_node(self, node):
node.timed_options['notimer'] = 'data-no-timer'
else:
node.timed_options['notimer'] = ''

if 'fullwidth' in node.timed_options:
node.timed_options['fullwidth'] = 'data-fullwidth'
else:
node.timed_options['fullwidth'] = ''

res = TEMPLATE_START % node.timed_options
self.body.append(res)
Expand All @@ -59,7 +64,7 @@ def depart_timed_node(self,node):

#Templates to be formatted by node options
TEMPLATE_START = '''
<ul data-component="timedAssessment" %(timelimit)s id="%(divid)s" %(noresult)s %(nofeedback)s %(notimer)s>
<ul data-component="timedAssessment" %(timelimit)s id="%(divid)s" %(noresult)s %(nofeedback)s %(notimer)s %(fullwidth)s>
'''

TEMPLATE_END = '''</ul>
Expand All @@ -72,6 +77,7 @@ class TimedDirective(Directive):
option_spec = {"timelimit":directives.positive_int,
"noresult":directives.flag,
"nofeedback":directives.flag,
"fullwidth":directives.flag,
"notimer":directives.flag}

def run(self):
Expand All @@ -84,6 +90,7 @@ def run(self):
:noresult: Boolean, doesn't display score
:nofeedback: Boolean, doesn't display feedback
:notimer: Boolean, doesn't show timer
:fullwidth: Boolean, allows the items in the timed assessment to take the full width of the screen
...
"""
self.assert_has_content() # make sure timed has something in it
Expand Down