WIP integration of edit-a-molecule
This commit is contained in:
committed by
Victor Shnayder
parent
c5b86f3e81
commit
f68f023e35
@@ -850,11 +850,16 @@ class EditAMoleculeInput(InputTypeBase):
|
||||
"""
|
||||
Can set size of text field.
|
||||
"""
|
||||
return [Attribute('file'),]
|
||||
return [Attribute('file'),
|
||||
Attribute('missing', None)]
|
||||
|
||||
def _extra_context(self):
|
||||
"""
|
||||
"""
|
||||
return {'applet_loader': '/static/js/capa/edit_a_molecule.js',}
|
||||
context = {
|
||||
'applet_loader': '/static/js/capa/edit-a-molecule.js',
|
||||
}
|
||||
|
||||
return context
|
||||
|
||||
registry.register(EditAMoleculeInput)
|
||||
|
||||
@@ -875,7 +875,7 @@ def sympy_check2():
|
||||
|
||||
allowed_inputfields = ['textline', 'textbox', 'crystallography',
|
||||
'chemicalequationinput', 'vsepr_input',
|
||||
'drag_and_drop_input']
|
||||
'drag_and_drop_input', 'editamoleculeinput']
|
||||
|
||||
def setup_response(self):
|
||||
xml = self.xml
|
||||
|
||||
@@ -31,10 +31,11 @@
|
||||
|
||||
<div id="input_${id}_preview" class="equation">
|
||||
</div>
|
||||
|
||||
|
||||
<p id="answer_${id}" class="answer"></p>
|
||||
|
||||
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
</div>
|
||||
% endif
|
||||
</section>
|
||||
2
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<section id="editamoleculeinput_${id}" class="editamoleculeinput">
|
||||
<div class="script_placeholder" data-src="/static/js/capa/jsmolcalc/jsmolcalc.nocache.js"/>
|
||||
<div class="script_placeholder" data-src="${applet_loader}"/>
|
||||
|
||||
% if status == 'unsubmitted':
|
||||
@@ -11,26 +12,29 @@
|
||||
<div class="incorrect" id="status_${id}">
|
||||
% endif
|
||||
|
||||
<input type="text" name="input_${id}" id="input_${id}" value="${value|h}"/>
|
||||
<!-- <object type="application/x-java-applet" id="applet_${id}" class="applet" height="400" width="500"> -->
|
||||
<!-- <param name="archive" value="/static/applets/capa/edit-a-molecule.jar" /> -->
|
||||
<!-- <param name="code" value="JME.class" /> -->
|
||||
<!-- <param name="file" value="${file}" /> -->
|
||||
<!-- Applet failed to run. No Java plug-in was found. -->
|
||||
<!-- </object> -->
|
||||
|
||||
<p class="status">
|
||||
% if status == 'unsubmitted':
|
||||
unanswered
|
||||
% elif status == 'correct':
|
||||
correct
|
||||
% elif status == 'incorrect':
|
||||
incorrect
|
||||
% elif status == 'incomplete':
|
||||
incomplete
|
||||
% endif
|
||||
</p>
|
||||
<input type="hidden" name="input_${id}" id="input_${id}" value="${value|h}"/>
|
||||
|
||||
<div id="input_${id}_preview" class="equation">
|
||||
</div>
|
||||
|
||||
<p id="answer_${id}" class="answer"></p>
|
||||
<p class="status">
|
||||
% if status == 'unsubmitted':
|
||||
unanswered
|
||||
% elif status == 'correct':
|
||||
correct
|
||||
% elif status == 'incorrect':
|
||||
incorrect
|
||||
% elif status == 'incomplete':
|
||||
incomplete
|
||||
% endif
|
||||
</p>
|
||||
|
||||
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
</div>
|
||||
<p id="answer_${id}" class="answer"></p>
|
||||
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
|
||||
</div>
|
||||
% endif
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user