From 26b12d5df692dc8e76fa79ec98e9bdd491d1a8d4 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 17 Aug 2017 16:57:38 +0200 Subject: [PATCH] match exercise stub --- src/editor/plugins/core/edumed/edumed.js | 6 ++-- .../plugins/core/edumed/match/element.js | 29 +++++++++++++++++++ .../plugins/core/edumed/match/view.html | 3 ++ src/wlxml/extensions/edumed/edumed.js | 5 ++-- src/wlxml/extensions/edumed/match.xml | 10 +++++++ 5 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 src/editor/plugins/core/edumed/match/element.js create mode 100644 src/editor/plugins/core/edumed/match/view.html create mode 100644 src/wlxml/extensions/edumed/match.xml diff --git a/src/editor/plugins/core/edumed/edumed.js b/src/editor/plugins/core/edumed/edumed.js index 6ba5996..9ccae6a 100644 --- a/src/editor/plugins/core/edumed/edumed.js +++ b/src/editor/plugins/core/edumed/edumed.js @@ -8,11 +8,13 @@ var actions = require('./actions'), orderExerciseElement = require('./order/element'), gapsExerciseElement = require('./gaps/element'), replaceExerciseElement = require('./replace/element'), - choiceExerciseElements = require('./choice/element'); + choiceExerciseElements = require('./choice/element'), + matchExerciseElement = require('./match/element'); return { actions: actions.concat(gapsActions).concat(replaceActions), - canvasElements: [orderExerciseElement, gapsExerciseElement, replaceExerciseElement].concat(choiceExerciseElements) + canvasElements: [orderExerciseElement, gapsExerciseElement, replaceExerciseElement, matchExerciseElement] + .concat(choiceExerciseElements) }; }); \ No newline at end of file diff --git a/src/editor/plugins/core/edumed/match/element.js b/src/editor/plugins/core/edumed/match/element.js new file mode 100644 index 0000000..dda31ba --- /dev/null +++ b/src/editor/plugins/core/edumed/match/element.js @@ -0,0 +1,29 @@ +define(function(require) { + +'use strict'; + + +var $ = require('libs/jquery'), + _ = require('libs/underscore'), + elementBase = require('plugins/core/edumed/elementBase'), + viewTemplate = require('libs/text!./view.html'); + +var MatchExerciseElement = Object.create(elementBase); +_.extend(MatchExerciseElement, { + init: function() { + elementBase.init.call(this); + var view = $(_.template(viewTemplate)()); + this._container().append(view); + + this.createContainer(this.wlxmlNode.contents(), { + resetBackground: true, + manages: function() { + return true; + } + }); + } +}); + +return {tag: 'div', klass: 'exercise.match', prototype: MatchExerciseElement}; + +}); diff --git a/src/editor/plugins/core/edumed/match/view.html b/src/editor/plugins/core/edumed/match/view.html new file mode 100644 index 0000000..ce56ca7 --- /dev/null +++ b/src/editor/plugins/core/edumed/match/view.html @@ -0,0 +1,3 @@ +
+
<%= gettext('Exercise') %>: <%= gettext('Match') %>
+
\ No newline at end of file diff --git a/src/wlxml/extensions/edumed/edumed.js b/src/wlxml/extensions/edumed/edumed.js index ca29ad3..8c7472c 100644 --- a/src/wlxml/extensions/edumed/edumed.js +++ b/src/wlxml/extensions/edumed/edumed.js @@ -9,7 +9,8 @@ var _ = require('libs/underscore'), 'choice.single': require('libs/text!./choiceSingle.xml'), 'choice.true-or-false': require('libs/text!./choiceTrueOrFalse.xml'), gap: require('libs/text!./gaps.xml'), - replace: require('libs/text!./replace.xml') + replace: require('libs/text!./replace.xml'), + match: require('libs/text!./match.xml') }; var Item = function(node, exerciseNode) { @@ -212,7 +213,7 @@ extension.wlxmlClass['exercise.choice.true-or-false'] = { methods: choiceMethods }; -extension.wlxmlClass['exercise.gap'] = extension.wlxmlClass['exercise.replace'] = { +extension.wlxmlClass['exercise.gap'] = extension.wlxmlClass['exercise.replace'] = extension.wlxmlClass['exercise.match'] = { methods: { isContextRoot: function(node) { return this.sameNode(node); diff --git a/src/wlxml/extensions/edumed/match.xml b/src/wlxml/extensions/edumed/match.xml new file mode 100644 index 0000000..c5fa4da --- /dev/null +++ b/src/wlxml/extensions/edumed/match.xml @@ -0,0 +1,10 @@ +
+
[polecenie]
+
+
a
+
+
nagłówek:
+
+
alina
+
+
\ No newline at end of file -- 2.20.1