diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py
index 951104501a..d825bdbf88 100644
--- a/common/lib/capa/capa/inputtypes.py
+++ b/common/lib/capa/capa/inputtypes.py
@@ -909,15 +909,15 @@ registry.register(DesignProtein2dInput)
class EditAGeneInput(InputTypeBase):
"""
An input type for editing a gene. Integrates with the genex java applet.
-
+
Example:
-
+
"""
-
+
template = "editageneinput.html"
tags = ['editageneinput']
-
+
@classmethod
def get_attributes(cls):
"""
@@ -927,15 +927,58 @@ class EditAGeneInput(InputTypeBase):
Attribute('height'),
Attribute('dna_sequence')
]
-
+
def _extra_context(self):
"""
"""
context = {
'applet_loader': '/static/js/capa/edit-a-gene.js',
}
-
+
return context
registry.register(EditAGeneInput)
+#---------------------------------------------------------------------
+
+class AnnotationInput(InputTypeBase):
+ """
+ Input type for annotations / tags: students can enter some notes or other text
+ (currently ungraded), and then choose from a set of tags, which are graded.
+
+ Example:
+
+
+ Dr Seuss uses colors! How?
+ Write down some notes:
+ Now pick the right color
+
+
+
+
+
+
+
+ The location of the sky
+
+ # TODO: allow ordering to be randomized
+ """
+
+ template = "annotationinput.html"
+ tags = ['annotationinput']
+
+ def setup(self):
+ # Pull out all the things from the xml
+ self.text = 'text'
+ self.comment_prompt = 'comment_prompt'
+ self.tag_prompt = 'tag_prompt'
+ self.options = [(0, 'blue'), (1, 'green'), (2, 'red')]
+
+ def _extra_context(self):
+ return {'text': self.text,
+ 'comment_prompt': self.comment_prompt,
+ 'tag_prompt': self.tag_prompt,
+ 'options': self.options}
+
+registry.register(AnnotationInput)
+
diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py
index a1a4e6b65e..529b409a96 100644
--- a/common/lib/capa/capa/responsetypes.py
+++ b/common/lib/capa/capa/responsetypes.py
@@ -882,7 +882,8 @@ def sympy_check2():
allowed_inputfields = ['textline', 'textbox', 'crystallography',
'chemicalequationinput', 'vsepr_input',
'drag_and_drop_input', 'editamoleculeinput',
- 'designprotein2dinput', 'editageneinput']
+ 'designprotein2dinput', 'editageneinput',
+ 'annotationinput']
def setup_response(self):
xml = self.xml
diff --git a/common/lib/capa/capa/templates/annotationinput.html b/common/lib/capa/capa/templates/annotationinput.html
new file mode 100644
index 0000000000..d1a7370733
--- /dev/null
+++ b/common/lib/capa/capa/templates/annotationinput.html
@@ -0,0 +1,37 @@
+
+
+% if msg:
+${msg|n}
+% endif
+
diff --git a/common/static/js/capa/annotationinput.js b/common/static/js/capa/annotationinput.js
new file mode 100644
index 0000000000..8bb18b1497
--- /dev/null
+++ b/common/static/js/capa/annotationinput.js
@@ -0,0 +1,11 @@
+(function () {
+ var update = function() {
+ alert("o hi");
+ };
+
+ var inputs = $('.annotation-input input');
+ // update on load
+ inputs.each(update);
+ // and on every change
+ inputs.bind("input", update);
+}).call(this);