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
11495563
Commit
11495563
authored
Jul 31, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaks to CodeMirror: fix indentation, textarea is vertically resizable
parent
2e3c5de1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
common/lib/capa/capa/inputtypes.py
+9
-3
common/lib/capa/capa/templates/textbox.html
+7
-2
No files found.
common/lib/capa/capa/inputtypes.py
View file @
11495563
...
...
@@ -313,14 +313,20 @@ def textbox(element, value, status, render_template, msg=''):
size
=
element
.
get
(
'size'
)
rows
=
element
.
get
(
'rows'
)
or
'30'
cols
=
element
.
get
(
'cols'
)
or
'80'
mode
=
element
.
get
(
'mode'
)
or
'python'
# mode for CodeMirror, eg "python" or "xml"
hidden
=
element
.
get
(
'hidden'
,
''
)
# if specified, then textline is hidden and id is stored in div of name given by hidden
linenumbers
=
element
.
get
(
'linenumbers'
,
'true'
)
# for CodeMirror
if
not
value
:
value
=
element
.
text
# if no student input yet, then use the default input given by the problem
# For CodeMirror
mode
=
element
.
get
(
'mode'
)
or
'python'
# mode, eg "python" or "xml"
linenumbers
=
element
.
get
(
'linenumbers'
,
'true'
)
# for CodeMirror
tabsize
=
element
.
get
(
'tabsize'
,
'4'
)
tabsize
=
int
(
tabsize
)
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
status
,
'count'
:
count
,
'size'
:
size
,
'msg'
:
msg
,
'mode'
:
mode
,
'linenumbers'
:
linenumbers
,
'rows'
:
rows
,
'cols'
:
cols
,
'hidden'
:
hidden
,
'hidden'
:
hidden
,
'tabsize'
:
tabsize
,
}
html
=
render_template
(
"textbox.html"
,
context
)
try
:
...
...
common/lib/capa/capa/templates/textbox.html
View file @
11495563
...
...
@@ -35,15 +35,20 @@
lineNumbers
:
true
,
%
endif
mode
:
"${mode}"
,
tabsize
:
4
,
matchBrackets
:
true
,
lineWrapping
:
true
,
indentUnit
:
"${tabsize}"
,
tabSize
:
"${tabsize}"
,
smartIndent
:
false
});
});
</script>
<style
type=
"text/css"
>
.CodeMirror
{
border
:
2
px
solid
black
;
border
:
1
px
solid
black
;
font-size
:
14px
;
line-height
:
18px
;
resize
:
vertical
;
}
</style>
</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