From 2e50dcc30973e754b4d04bad89f521fbf8027138 Mon Sep 17 00:00:00 2001 From: ericsonga Date: Mon, 27 Jun 2016 20:34:35 -0400 Subject: [PATCH] Added a fullwidth option to the timed exam to allow full width on Parsons I added a fullwidth option to the timed exam to allow timed Parsons problems to take up the full width of the screen --- runestone/assess/js/timed.js | 11 +++++++++++ runestone/assess/timedassessment.py | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/runestone/assess/js/timed.js b/runestone/assess/js/timed.js index a8855e3ee..113bc798d 100644 --- a/runestone/assess/js/timed.js +++ b/runestone/assess/js/timed.js @@ -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; @@ -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 diff --git a/runestone/assess/timedassessment.py b/runestone/assess/timedassessment.py index f7429ccf0..329663b4a 100644 --- a/runestone/assess/timedassessment.py +++ b/runestone/assess/timedassessment.py @@ -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) @@ -59,7 +64,7 @@ def depart_timed_node(self,node): #Templates to be formatted by node options TEMPLATE_START = ''' -