match exercise stub
authorJan Szejko <janek37@gmail.com>
Thu, 17 Aug 2017 14:57:38 +0000 (16:57 +0200)
committerJan Szejko <janek37@gmail.com>
Thu, 17 Aug 2017 14:57:38 +0000 (16:57 +0200)
src/editor/plugins/core/edumed/edumed.js
src/editor/plugins/core/edumed/match/element.js [new file with mode: 0644]
src/editor/plugins/core/edumed/match/view.html [new file with mode: 0644]
src/wlxml/extensions/edumed/edumed.js
src/wlxml/extensions/edumed/match.xml [new file with mode: 0644]

index 6ba5996..9ccae6a 100644 (file)
@@ -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 (file)
index 0000000..dda31ba
--- /dev/null
@@ -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 (file)
index 0000000..ce56ca7
--- /dev/null
@@ -0,0 +1,3 @@
+<div class="edumed-exercise exercise-match">
+    <div class="header"><%= gettext('Exercise') %>: <%= gettext('Match') %></div>
+</div>
\ No newline at end of file
index ca29ad3..8c7472c 100644 (file)
@@ -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 (file)
index 0000000..c5fa4da
--- /dev/null
@@ -0,0 +1,10 @@
+<div class="exercise.match">
+    <div class="p">[polecenie]</div>
+    <div class="list" name="kategorie">
+        <div class="item.category" name="1">a</div>
+    </div>
+    <div class="p">nagłówek:</div>
+    <div class="list" dest="kategorie">
+        <div class="item.answer" answer="1">alina</div>
+    </div>
+</div>
\ No newline at end of file