Commit c3a098db by Tim Krones

Address review comments.

parent f19ab786
...@@ -4,6 +4,7 @@ function StudioEditableXBlockMixin(runtime, element) { ...@@ -4,6 +4,7 @@ function StudioEditableXBlockMixin(runtime, element) {
var fields = []; var fields = [];
var tinyMceAvailable = (typeof $.fn.tinymce !== 'undefined'); // Studio includes a copy of tinyMCE and its jQuery plugin var tinyMceAvailable = (typeof $.fn.tinymce !== 'undefined'); // Studio includes a copy of tinyMCE and its jQuery plugin
var errorMessage = gettext("This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.");
$(element).find('.field-data-control').each(function() { $(element).find('.field-data-control').each(function() {
var $field = $(this); var $field = $(this);
...@@ -71,20 +72,20 @@ function StudioEditableXBlockMixin(runtime, element) { ...@@ -71,20 +72,20 @@ function StudioEditableXBlockMixin(runtime, element) {
url: handlerUrl, url: handlerUrl,
data: JSON.stringify(data), data: JSON.stringify(data),
dataType: "json", dataType: "json",
global: false, // Disable Studio's error handling that conflicts with studio's notify('save') and notify('cancel') :-/ global: false // Disable Studio's error handling that conflicts with studio's notify('save') and notify('cancel') :-/
success: function(response) { runtime.notify('save', {state: 'end'}); } }).done(function(response) {
runtime.notify('save', {state: 'end'});
}).fail(function(jqXHR) { }).fail(function(jqXHR) {
var message = gettext("This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.");
if (jqXHR.responseText) { // Is there a more specific error message we can show? if (jqXHR.responseText) { // Is there a more specific error message we can show?
try { try {
message = JSON.parse(jqXHR.responseText).error; errorMessage = JSON.parse(jqXHR.responseText).error;
if (typeof message === "object" && message.messages) { if (typeof errorMessage === "object" && errorMessage.messages) {
// e.g. {"error": {"messages": [{"text": "Unknown user 'bob'!", "type": "error"}, ...]}} etc. // e.g. {"error": {"messages": [{"text": "Unknown user 'bob'!", "type": "error"}, ...]}} etc.
message = $.map(message.messages, function(msg) { return msg.text; }).join(", "); errorMessage = $.map(errorMessage.messages, function(msg) { return msg.text; }).join(", ");
} }
} catch (error) { message = jqXHR.responseText.substr(0, 300); } } catch (error) { errorMessage = jqXHR.responseText.substr(0, 300); }
} }
runtime.notify('error', {title: gettext("Unable to update settings"), message: message}); runtime.notify('error', {title: gettext("Unable to update settings"), message: errorMessage});
}); });
}; };
......
...@@ -68,12 +68,15 @@ ...@@ -68,12 +68,15 @@
<p id="wysiwyg-description"> <p id="wysiwyg-description">
{% blocktrans %} {% blocktrans %}
Use the board below to define a set of working vectors for this exercise. Instead of using the "Vectors" field above to define or modify
the set of working vectors for this exercise, you can also use the board below.
To add a vector, left-click the board where you want the vector to originate. To add a vector, left-click the board where you want the vector to originate.
Keep holding down the left mouse button and drag your mouse pointer across the board Keep holding down the left mouse button and drag your mouse pointer across the board
to achieve the desired length and angle for the vector. to achieve the desired length and angle for the vector.
To modify an existing vector, left-click it, hold down the left mouse button, To modify an existing vector, left-click it, hold down the left mouse button,
and move your mouse pointer across the board. and move your mouse pointer across the board.
Note that if you make changes using the board below, any changes you made via the "Vectors" field above
will be overwritten when you save the settings for this exercise by clicking the "Save" button below.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
......
...@@ -139,8 +139,9 @@ class VectorDrawXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -139,8 +139,9 @@ class VectorDrawXBlock(StudioEditableXBlockMixin, XBlock):
"List of vectors to use for the exercise. " "List of vectors to use for the exercise. "
"You must specify it as an array of entries " "You must specify it as an array of entries "
"where each entry represents an individual vector. " "where each entry represents an individual vector. "
"Note that edits to vectors made via the WYSIWYG editor below " "Note that you can also use the WYSIWYG editor below to create or modify vectors. "
"take precedence over changes you make here when saving." "If you do, any changes you make here will be overwritten by vector data "
"from the WYSIWYG editor when saving."
), ),
default="[]", default="[]",
multiline_editor=True, multiline_editor=True,
......
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