Skip to content

Commit

Permalink
MDL-55911 Quiz: Accessibility, Label blanks in DD questions
Browse files Browse the repository at this point in the history
  • Loading branch information
Beedell committed Sep 23, 2016
1 parent 1de7444 commit 4296f2b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 6 deletions.
Expand Up @@ -26,6 +26,7 @@
$string['addmoreimages'] = 'Blanks for {no} more draggable items';
$string['answer'] = 'Answer';
$string['bgimage'] = 'Background image';
$string['blank'] = 'blank';
$string['correctansweris'] = 'The correct answer is: {$a}';
$string['draggableimage'] = 'Draggable image';
$string['draggableitem'] = 'Draggable item';
Expand Down
1 change: 1 addition & 0 deletions question/type/ddimageortext/rendererbase.php
Expand Up @@ -117,6 +117,7 @@ public function formulation_and_controls(question_attempt $qa,
'topnode' => $topnode,
'readonly' => $options->readonly);

$PAGE->requires->string_for_js('blank', 'qtype_ddimageortext');
$PAGE->requires->yui_module('moodle-qtype_ddimageortext-dd',
'M.qtype_ddimageortext.init_question',
array($params));
Expand Down
Expand Up @@ -482,7 +482,11 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var drop = this.get('drops')[dropno];
var nodeclass = 'dropzone group' + drop.group + ' place' + dropno;
var title = drop.text.replace('"', '\"');
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">&nbsp;</div>';
if (!title) {
title = M.util.get_string('blank', 'qtype_ddimageortext');
}
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">' +
'<span class="accesshide">' + title + '</span>&nbsp;</div>';
var dropnode = Y.Node.create(dropnodehtml);
groupnodes[drop.group].append(dropnode);
dropnode.setStyles({'opacity': 0.5});
Expand Down Expand Up @@ -530,4 +534,5 @@ M.qtype_ddimageortext.init_question = function(config) {
return new DDIMAGEORTEXT_QUESTION(config);
};


}, '@VERSION@', {"requires": ["node", "dd", "dd-drop", "dd-constrain"]});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -482,7 +482,11 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var drop = this.get('drops')[dropno];
var nodeclass = 'dropzone group' + drop.group + ' place' + dropno;
var title = drop.text.replace('"', '\"');
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">&nbsp;</div>';
if (!title) {
title = M.util.get_string('blank', 'qtype_ddimageortext');
}
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">' +
'<span class="accesshide">' + title + '</span>&nbsp;</div>';
var dropnode = Y.Node.create(dropnodehtml);
groupnodes[drop.group].append(dropnode);
dropnode.setStyles({'opacity': 0.5});
Expand Down Expand Up @@ -530,4 +534,5 @@ M.qtype_ddimageortext.init_question = function(config) {
return new DDIMAGEORTEXT_QUESTION(config);
};


}, '@VERSION@', {"requires": ["node", "dd", "dd-drop", "dd-constrain"]});
Expand Up @@ -480,7 +480,11 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var drop = this.get('drops')[dropno];
var nodeclass = 'dropzone group' + drop.group + ' place' + dropno;
var title = drop.text.replace('"', '\"');
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">&nbsp;</div>';
if (!title) {
title = M.util.get_string('blank', 'qtype_ddimageortext');
}
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">' +
'<span class="accesshide">' + title + '</span>&nbsp;</div>';
var dropnode = Y.Node.create(dropnodehtml);
groupnodes[drop.group].append(dropnode);
dropnode.setStyles({'opacity': 0.5});
Expand Down Expand Up @@ -526,4 +530,4 @@ Y.Event.define('dragchange', {

M.qtype_ddimageortext.init_question = function(config) {
return new DDIMAGEORTEXT_QUESTION(config);
};
};
1 change: 1 addition & 0 deletions question/type/ddwtos/lang/en/qtype_ddwtos.php
Expand Up @@ -24,6 +24,7 @@

$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
$string['answer'] = 'Answer';
$string['blank'] = 'blank';
$string['correctansweris'] = 'The correct answer is: {$a}';
$string['infinite'] = 'Unlimited';
$string['pleaseputananswerineachbox'] = 'Please put an answer in each box.';
Expand Down
3 changes: 2 additions & 1 deletion question/type/ddwtos/renderer.php
Expand Up @@ -104,7 +104,8 @@ protected function embedded_element(question_attempt $qa, $place,
question_display_options $options) {
$question = $qa->get_question();
$group = $question->places[$place];
$boxcontents = '&#160;';
$boxcontents = '&#160;' . html_writer::tag('span',
get_string('blank', 'qtype_ddwtos'), array('class' => 'accesshide'));

$value = $qa->get_last_qt_var($question->field($place));

Expand Down

0 comments on commit 4296f2b

Please sign in to comment.