Commit d3cd85d8 by kimth

Merge pull request #627 from MITx/feature/kfiedler/problems

Style changes to problems
parents d0fcbdda 7c8838a6
......@@ -470,9 +470,9 @@ def math(element, value, status, render_template, msg=''):
xhtml = etree.XML(html)
except Exception as err:
if False: # TODO needs to be self.system.DEBUG - but can't access system
msg = "<html><font color='red'><p>Error %s</p>" % str(err).replace('<', '&lt;')
msg = '<html><div class="inline-error"><p>Error %s</p>' % str(err).replace('<', '&lt;')
msg += '<p>Failed to construct math expression from <pre>%s</pre></p>' % html.replace('<', '&lt;')
msg += "</font></html>"
msg += "</div></html>"
log.error(msg)
return etree.XML(msg)
else:
......
......@@ -886,7 +886,7 @@ def sympy_check2():
if len(idset) == 1 and not submission[0]:
# default to no error message on empty answer (to be consistent with other responsetypes)
# but allow author to still have the old behavior by setting empty_answer_err attribute
msg = '<font color="red">No answer entered!</font>' if self.xml.get('empty_answer_err') else ''
msg = '<span class="inline-error">No answer entered!</span>' if self.xml.get('empty_answer_err') else ''
return CorrectMap(idset[0], 'incorrect', msg=msg)
# NOTE: correct = 'unknown' could be dangerous. Inputtypes such as textline are not expecting 'unknown's
......@@ -1223,7 +1223,7 @@ class CodeResponse(LoncapaResponse):
return oldcmap
def get_answers(self):
anshtml = '<font color="blue"><span class="code-answer"><br/><pre>%s</pre><br/></span></font>' % self.answer
anshtml = '<span class="code-answer"><pre><code>%s</code></pre></span>' % self.answer
return {self.answer_id: anshtml}
def get_initial_display(self):
......@@ -1400,7 +1400,7 @@ main()
log.error('Error %s' % err)
if self.system.DEBUG:
cmap.set_dict(dict(zip(sorted(self.answer_ids), ['incorrect'] * len(idset))))
cmap.set_property(self.answer_ids[0], 'msg', '<font color="red" size="+2">%s</font>' % str(err).replace('<', '&lt;'))
cmap.set_property(self.answer_ids[0], 'msg', '<span class="inline-error">%s</span>' % str(err).replace('<', '&lt;'))
return cmap
ad = rxml.find('awarddetail').text
......@@ -1429,7 +1429,7 @@ main()
except Exception as err:
log.error('Error %s' % err)
if self.system.DEBUG:
msg = '<font color=red size=+2>%s</font>' % str(err).replace('<', '&lt;')
msg = '<span class="inline-error">%s</span>' % str(err).replace('<', '&lt;')
exans = [''] * len(self.answer_ids)
exans[0] = msg
......
<form class="option-input">
<select name="input_${id}" id="input_${id}" >
<option value="option_${id}_dummy_default"> </option>
% for option_id, option_description in options:
......
......@@ -155,8 +155,8 @@ class CapaModule(XModule):
msg = '<p>%s</p>' % msg.replace('<', '&lt;')
msg += '<p><pre>%s</pre></p>' % traceback.format_exc().replace('<', '&lt;')
# create a dummy problem with error message instead of failing
problem_text = ('<problem><text><font color="red" size="+2">'
'Problem %s has an error:</font>%s</text></problem>' %
problem_text = ('<problem><text><span class="inline-error">'
'Problem %s has an error:</span>%s</text></problem>' %
(self.location.url(), msg))
self.lcp = LoncapaProblem(
problem_text, self.location.html_id(),
......
......@@ -16,6 +16,9 @@ h2 {
}
}
.inline-error {
color: darken($error-red, 10%);
}
section.problem {
@media print {
......@@ -134,11 +137,19 @@ section.problem {
div.equation {
clear: both;
padding: 6px;
background: #eee;
margin-top: 3px;
span {
margin-bottom: 0;
&.math {
padding: 6px;
background: #f1f1f1;
border: 1px solid #e3e3e3;
@include inline-block;
@include border-radius(4px);
min-width: 300px;
}
}
}
......@@ -226,6 +237,15 @@ section.problem {
}
}
form.option-input {
margin: -10px 0 20px;
padding-bottom: 20px;
border-bottom: 1px solid #e3e3e3;
select {
margin-right: flex-gutter();
}
}
ul {
list-style: disc outside none;
......@@ -393,6 +413,8 @@ section.problem {
}
section.action {
margin-top: 20px;
input.save {
@extend .blue-button;
}
......
......@@ -70,9 +70,9 @@ def manage_modulestores(request,reload_dir=None):
if reload_dir is not None:
if reload_dir not in def_ms.courses:
html += "<h2><font color='red'>Error: '%s' is not a valid course directory</font></h2>" % reload_dir
html += '<h2 class="inline-error">Error: "%s" is not a valid course directory</h2>' % reload_dir
else:
html += "<h2><font color='blue'>Reloaded course directory '%s'</font></h2>" % reload_dir
html += '<h2>Reloaded course directory "%s"</h2>' % reload_dir
def_ms.try_load_course(reload_dir)
#----------------------------------------
......@@ -179,9 +179,9 @@ def gitreload(request, reload_dir=None):
if reload_dir is not None:
def_ms = modulestore()
if reload_dir not in def_ms.courses:
html += "<h2><font color='red'>Error: '%s' is not a valid course directory</font></h2>" % reload_dir
html += '<h2 class="inline-error">Error: "%s" is not a valid course directory</font></h2>' % reload_dir
else:
html += "<h2><font color='blue'>Reloaded course directory '%s'</font></h2>" % reload_dir
html += "<h2>Reloaded course directory '%s'</h2>" % reload_dir
def_ms.try_load_course(reload_dir)
track.views.server_track(request, 'reloaded %s' % reload_dir, {}, page='migrate')
......
......@@ -21,7 +21,7 @@
if(json.success) {
location.href="${reverse('dashboard')}";
}else{
$('#register_message').html("<p><font color='red'>" + json.error + "</font></p>");
$('#register_message').html('<p class="inline-error">' + json.error + "</p>");
}
});
})(this)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment