From c5b86f3e81fdabd5e24493b893a22dbe8272ac63 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Mon, 7 Jan 2013 13:40:36 -0500 Subject: [PATCH] Initial template for edit a molecule input --- common/lib/capa/capa/inputtypes.py | 29 +++++++++++++++ .../capa/capa/templates/editamolecule.html | 36 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 common/lib/capa/capa/templates/editamolecule.html diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index 0b0e86ce66..f0d9cddae5 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -829,3 +829,32 @@ class DragAndDropInput(InputTypeBase): registry.register(DragAndDropInput) #-------------------------------------------------------------------------------------------------------------------- + + +class EditAMoleculeInput(InputTypeBase): + """ + An input type for edit-a-molecule. Integrates with the molecule editor java applet. + + Example: + + + + options: size -- width of the textbox. + """ + + template = "editamolecule.html" + tags = ['editamoleculeinput'] + + @classmethod + def get_attributes(cls): + """ + Can set size of text field. + """ + return [Attribute('file'),] + + def _extra_context(self): + """ + """ + return {'applet_loader': '/static/js/capa/edit_a_molecule.js',} + +registry.register(EditAMoleculeInput) diff --git a/common/lib/capa/capa/templates/editamolecule.html b/common/lib/capa/capa/templates/editamolecule.html new file mode 100644 index 0000000000..75f723f82a --- /dev/null +++ b/common/lib/capa/capa/templates/editamolecule.html @@ -0,0 +1,36 @@ +
+
+ + % if status == 'unsubmitted': +
+ % elif status == 'correct': +
+ % elif status == 'incorrect': +
+ % elif status == 'incomplete': +
+ % endif + + + +

+ % if status == 'unsubmitted': + unanswered + % elif status == 'correct': + correct + % elif status == 'incorrect': + incorrect + % elif status == 'incomplete': + incomplete + % endif +

+ +
+
+ +

+ +% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']: +
+% endif +