From 88afe908cdc2cd584c551730a98d1b312df48958 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 6 Aug 2014 14:22:18 +0200 Subject: [PATCH 01/16] wlxml: isContextRoot for the reminder of edumed exercises (fixup) --- src/wlxml/extensions/edumed/edumed.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/wlxml/extensions/edumed/edumed.js b/src/wlxml/extensions/edumed/edumed.js index 6e01d6e..ca29ad3 100644 --- a/src/wlxml/extensions/edumed/edumed.js +++ b/src/wlxml/extensions/edumed/edumed.js @@ -157,6 +157,9 @@ var extension = {wlxmlClass: {'exercise.order': { }}}; var choiceMethods = { + isContextRoot: function(node) { + return this.object.isChoiceList(node.parent()) || this.sameNode(node); + }, getChoiceList: function() { return this.contents() .filter(function(n) { return this.object.isChoiceList(n); }.bind(this))[0]; @@ -209,6 +212,14 @@ extension.wlxmlClass['exercise.choice.true-or-false'] = { methods: choiceMethods }; +extension.wlxmlClass['exercise.gap'] = extension.wlxmlClass['exercise.replace'] = { + methods: { + isContextRoot: function(node) { + return this.sameNode(node); + } + } +}; + extension.document = { methods: { edumedCreateExerciseNode: function(klass) { -- 2.20.1 From c654f07dd8b596abc328f1f57beef06bffa63149 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 6 Aug 2014 14:30:29 +0200 Subject: [PATCH 02/16] editor: Missing names of exercises on a canvas --- src/editor/plugins/core/edumed/choice/choiceBase.js | 2 +- src/editor/plugins/core/edumed/choice/choiceMulti.js | 1 + src/editor/plugins/core/edumed/choice/choiceSingle.js | 1 + src/editor/plugins/core/edumed/choice/choiceTrueOrFalse.js | 1 + src/editor/plugins/core/edumed/choice/element.html | 2 +- src/editor/plugins/core/edumed/gaps/view.html | 2 +- src/editor/plugins/core/edumed/order/view.html | 2 +- src/editor/plugins/core/edumed/replace/view.html | 2 +- 8 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/editor/plugins/core/edumed/choice/choiceBase.js b/src/editor/plugins/core/edumed/choice/choiceBase.js index 3bd6ed5..eaf1c7c 100644 --- a/src/editor/plugins/core/edumed/choice/choiceBase.js +++ b/src/editor/plugins/core/edumed/choice/choiceBase.js @@ -12,7 +12,7 @@ var choiceBase = Object.create(elementBase); _.extend(choiceBase, { init: function() { elementBase.init.call(this); - this.view = $(_.template(template)({type: this.type})); + this.view = $(_.template(template)({type: this.type, name: this.name})); this._container().append(this.view); this.createContainer(this.wlxmlNode.contents().filter(function(n) {return !n.is('list');}), { diff --git a/src/editor/plugins/core/edumed/choice/choiceMulti.js b/src/editor/plugins/core/edumed/choice/choiceMulti.js index a05346c..0983930 100644 --- a/src/editor/plugins/core/edumed/choice/choiceMulti.js +++ b/src/editor/plugins/core/edumed/choice/choiceMulti.js @@ -13,6 +13,7 @@ var $ = require('libs/jquery'), var choiceMulti = Object.create(choiceBase); _.extend(choiceMulti, { type: 'multi', + name: gettext('Multiple Choice'), createListView: function(listNode) { return new ListView(this, listNode, { onItemViewAdded: function(itemView) { diff --git a/src/editor/plugins/core/edumed/choice/choiceSingle.js b/src/editor/plugins/core/edumed/choice/choiceSingle.js index 9346363..6824d44 100644 --- a/src/editor/plugins/core/edumed/choice/choiceSingle.js +++ b/src/editor/plugins/core/edumed/choice/choiceSingle.js @@ -13,6 +13,7 @@ var $ = require('libs/jquery'), var choiceSingle = Object.create(choiceBase); _.extend(choiceSingle, { type: 'single', + name: gettext('Single Choice'), init: function() { this._comboName = _.uniqueId('edumed_exercise_hash_'); choiceBase.init.call(this); diff --git a/src/editor/plugins/core/edumed/choice/choiceTrueOrFalse.js b/src/editor/plugins/core/edumed/choice/choiceTrueOrFalse.js index 7ac0470..86fe809 100644 --- a/src/editor/plugins/core/edumed/choice/choiceTrueOrFalse.js +++ b/src/editor/plugins/core/edumed/choice/choiceTrueOrFalse.js @@ -14,6 +14,7 @@ var $ = require('libs/jquery'), var trueOrFalse = Object.create(choiceBase); _.extend(trueOrFalse, { type: 'true-or-false', + name: 'True or False', createListView: function(listNode) { return new ListView(this, listNode, { onItemViewAdded: function(itemView) { diff --git a/src/editor/plugins/core/edumed/choice/element.html b/src/editor/plugins/core/edumed/choice/element.html index ba4bdd0..665d957 100644 --- a/src/editor/plugins/core/edumed/choice/element.html +++ b/src/editor/plugins/core/edumed/choice/element.html @@ -1,5 +1,5 @@
-
<%= gettext('Exercise') %>: <%= type %>
+
<%= gettext('Exercise') %>: <%= name %>
\ No newline at end of file diff --git a/src/editor/plugins/core/edumed/gaps/view.html b/src/editor/plugins/core/edumed/gaps/view.html index bd1552e..7d4210b 100644 --- a/src/editor/plugins/core/edumed/gaps/view.html +++ b/src/editor/plugins/core/edumed/gaps/view.html @@ -1,4 +1,4 @@
-
<%= gettext('Exercise') %>
+
<%= gettext('Exercise') %>: <%= gettext('Gaps') %>
\ No newline at end of file diff --git a/src/editor/plugins/core/edumed/order/view.html b/src/editor/plugins/core/edumed/order/view.html index 492b8f4..561de89 100644 --- a/src/editor/plugins/core/edumed/order/view.html +++ b/src/editor/plugins/core/edumed/order/view.html @@ -1,5 +1,5 @@
-
<%= gettext('Exercise') %>
+
<%= gettext('Exercise') %>: <%= gettext('Order') %>