Permalink
Browse files

min-width on the feedback column in part marking testing

This also changes the display of `dict` values to "Dictionary with <N>
entries", instead of a JSON encoding.
  • Loading branch information...
christianp committed Jan 11, 2018
1 parent 52ef3c5 commit 74a0871ad12e8449309ef8f03f30af34d11dee04
@@ -118,6 +118,7 @@
.jme-value[data-jme-value-type="error"],
.jme-value[data-jme-value-type="string"],
.jme-value[data-jme-value-type="list"],
.jme-value[data-jme-value-type="dict"],
.jme-value[data-jme-value-type="html"] {
font-family: inherit;
}
@@ -155,6 +156,14 @@
.table.notes col.name {
width: 13em;
}
.table.notes col.feedback {
min-width: 13em;
}
.table.notes .note .value {
max-height: 5em;
overflow-y: auto;
overflow-x: hidden;
}

/*
#question-name {
@@ -1366,7 +1366,7 @@ $(document).ready(function() {
}
};

function displayJMEValue(v) {
var displayJMEValue = Editor.displayJMEValue = function(v) {
switch(v.type) {
case 'string':
return Numbas.util.escapeHTML(v.value);
@@ -1377,6 +1377,13 @@ $(document).ready(function() {
} else {
return 'List of '+v.value.length+' '+Numbas.util.pluralise(v.value.length,'item','items');
}
case 'dict':
var s = Numbas.jme.display.treeToJME({tok:v});
if(s.length<30) {
return s;
} else {
return 'Dictionary with '+Object.keys(v.value).length+" entries";
}
case 'html':
if(v.value.length==1 && v.value[0].tagName=='IMG') {
var src = v.value[0].getAttribute('src');
@@ -1364,30 +1364,10 @@ $(document).ready(function() {

this.display = ko.computed(function() {
var v;

if(this.anyError()) {
return this.anyError();
} else if(v = this.value()) {
switch(v.type)
{
case 'string':
return Numbas.util.escapeHTML(v.value);
case 'list':
var s = Numbas.jme.display.treeToJME({tok:v});
if(s.length<30) {
return s;
} else {
return 'List of '+v.value.length+' '+Numbas.util.pluralise(v.value.length,'item','items');
}
case 'html':
if(v.value.length==1 && v.value[0].tagName=='IMG') {
var src = v.value[0].getAttribute('src');
return '<img src="'+src+'" title="'+src+'">';
}
return 'HTML node';
default:
return Numbas.jme.display.treeToJME({tok:v});
}
return Editor.displayJMEValue(v);
} else {
return '';
}
@@ -551,6 +551,8 @@ <h4>Test that the marking algorithm works</h4>
<table class="notes table">
<colgroup>
<col class="name"></col>
<col class="value"></col>
<col class="feedback"></col>
</colgroup>
<thead>
<tr>
@@ -572,7 +574,7 @@ <h4>Test that the marking algorithm works</h4>
<span class="name monospace" data-bind="text: name, attr: {title: description}"></span>
</td>
<td class="only-when-shown">
<span class="value jme-value" data-bind="jmevalue: value, error: error"></span>
<div class="value jme-value" data-bind="jmevalue: value, error: error"></div>
</td>
<td class="only-when-shown">
<ul class="list-unstyled" data-bind="foreach: messages">

0 comments on commit 74a0871

Please sign in to comment.