Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c5b86f3e
Commit
c5b86f3e
authored
Jan 07, 2013
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial template for edit a molecule input
parent
d0d15c0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
common/lib/capa/capa/inputtypes.py
+29
-0
common/lib/capa/capa/templates/editamolecule.html
+36
-0
No files found.
common/lib/capa/capa/inputtypes.py
View file @
c5b86f3e
...
@@ -829,3 +829,32 @@ class DragAndDropInput(InputTypeBase):
...
@@ -829,3 +829,32 @@ class DragAndDropInput(InputTypeBase):
registry
.
register
(
DragAndDropInput
)
registry
.
register
(
DragAndDropInput
)
#--------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------------------------
class
EditAMoleculeInput
(
InputTypeBase
):
"""
An input type for edit-a-molecule. Integrates with the molecule editor java applet.
Example:
<editamolecule size="50"/>
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
)
common/lib/capa/capa/templates/editamolecule.html
0 → 100644
View file @
c5b86f3e
<section
id=
"editamoleculeinput_${id}"
class=
"editamoleculeinput"
>
<div
class=
"script_placeholder"
data-src=
"${applet_loader}"
/>
% if status == 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
% elif status == 'correct':
<div
class=
"correct"
id=
"status_${id}"
>
% elif status == 'incorrect':
<div
class=
"incorrect"
id=
"status_${id}"
>
% elif status == 'incomplete':
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value|h}"
/>
<p
class=
"status"
>
% if status == 'unsubmitted':
unanswered
% elif status == 'correct':
correct
% elif status == 'incorrect':
incorrect
% elif status == 'incomplete':
incomplete
% endif
</p>
<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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment