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
2caa5a51
Commit
2caa5a51
authored
Jan 09, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cas/speed-editor' of github.com:MITx/mitx into feature/cas/speed-editor
parents
b3d168b6
603c6ce2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
23 deletions
+20
-23
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
+5
-2
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
+7
-13
common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml
+2
-2
common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml
+2
-2
common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml
+2
-2
common/lib/xmodule/xmodule/templates/problem/string_response.yaml
+2
-2
No files found.
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
View file @
2caa5a51
...
@@ -10,8 +10,11 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -10,8 +10,11 @@ describe 'MarkdownEditingDescriptor', ->
it
'recognizes x as a selection if there is non-whitespace after x'
,
->
it
'recognizes x as a selection if there is non-whitespace after x'
,
->
revisedSelection
=
MarkdownEditingDescriptor
.
insertMultipleChoice
(
'a
\n
x b
\n
c
\n
x
\n
d
\n
x e'
)
revisedSelection
=
MarkdownEditingDescriptor
.
insertMultipleChoice
(
'a
\n
x b
\n
c
\n
x
\n
d
\n
x e'
)
expect
(
revisedSelection
).
toEqual
(
'( ) a
\n
(x) b
\n
( ) c
\n
( ) x
\n
( ) d
\n
(x) e
\n
'
)
expect
(
revisedSelection
).
toEqual
(
'( ) a
\n
(x) b
\n
( ) c
\n
( ) x
\n
( ) d
\n
(x) e
\n
'
)
it
'removes multiple newlines'
,
->
it
'recognizes x as a selection if it is first non whitespace and has whitespace with other non-whitespace'
,
->
revisedSelection
=
MarkdownEditingDescriptor
.
insertMultipleChoice
(
'a
\n
x b
\n\n\n
c'
)
revisedSelection
=
MarkdownEditingDescriptor
.
insertMultipleChoice
(
' x correct
\n
x
\n
ex post facto
\n
b x c
\n
x c'
)
expect
(
revisedSelection
).
toEqual
(
'(x) correct
\n
( ) x
\n
( ) ex post facto
\n
( ) b x c
\n
(x) c
\n
'
)
it
'removes multiple newlines but not last one'
,
->
revisedSelection
=
MarkdownEditingDescriptor
.
insertMultipleChoice
(
'a
\n
x b
\n\n\n
c
\n
'
)
expect
(
revisedSelection
).
toEqual
(
'( ) a
\n
(x) b
\n
( ) c
\n
'
)
expect
(
revisedSelection
).
toEqual
(
'( ) a
\n
(x) b
\n
( ) c
\n
'
)
describe
'insertCheckboxChoice'
,
->
describe
'insertCheckboxChoice'
,
->
...
...
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
View file @
2caa5a51
...
@@ -131,23 +131,17 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
...
@@ -131,23 +131,17 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
@
insertGenericChoice
:
(
selectedText
,
choiceStart
,
choiceEnd
,
template
)
->
@
insertGenericChoice
:
(
selectedText
,
choiceStart
,
choiceEnd
,
template
)
->
if
selectedText
.
length
>
0
if
selectedText
.
length
>
0
# Replace adjacent newlines with a single newline
# Replace adjacent newlines with a single newline
, strip any trailing newline
cleanSelectedText
=
selectedText
.
replace
(
/\n+/g
,
'
\n
'
)
cleanSelectedText
=
selectedText
.
replace
(
/\n+/g
,
'
\n
'
)
.
replace
(
/\n$/
,
''
)
lines
=
cleanSelectedText
.
split
(
'
\n
'
)
lines
=
cleanSelectedText
.
split
(
'
\n
'
)
revisedLines
=
''
revisedLines
=
''
for
line
in
lines
for
line
in
lines
revisedLines
+=
choiceStart
revisedLines
+=
choiceStart
# This is looking for a x before text to mark as selected.
# a stand alone x before other text implies that this option is "correct"
if
/x\s/i
.
test
(
line
)
if
/^\s*x\s*(\S)/i
.
test
(
line
)
# Remove the x and any initial whitespace
# Remove the x and any initial whitespace as long as there's more text on the line
lineWithoutX
=
line
.
replace
(
/^(\s+)?x/i
,
''
)
line
=
line
.
replace
(
/^\s*x\s*(\S)/i
,
'$1'
)
# Check if any non-whitespace chars remain on the line
revisedLines
+=
'x'
if
not
/^\s+$/
.
test
(
lineWithoutX
)
# Remove initial whitespace, x, and space immediately after
line
=
line
.
replace
(
/^(\s+)?x\s/i
,
''
)
revisedLines
+=
'x'
else
revisedLines
+=
' '
else
else
revisedLines
+=
' '
revisedLines
+=
' '
revisedLines
+=
choiceEnd
+
' '
+
line
+
'
\n
'
revisedLines
+=
choiceEnd
+
' '
+
line
+
'
\n
'
...
...
common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml
View file @
2caa5a51
...
@@ -3,8 +3,8 @@ metadata:
...
@@ -3,8 +3,8 @@ metadata:
display_name
:
Multiple Choice
display_name
:
Multiple Choice
rerandomize
:
never
rerandomize
:
never
showanswer
:
always
showanswer
:
always
markdown
:
"
markdown
:
A
multiple
choice
problem
presents
radio
buttons
for
student
input.
Students
can
only
select
a
single
"
A
multiple
choice
problem
presents
radio
buttons
for
student
input.
Students
can
only
select
a
single
option
presented.
Multiple
Choice
questions
have
been
the
subject
of
many
areas
of
research
due
to
the
early
option
presented.
Multiple
Choice
questions
have
been
the
subject
of
many
areas
of
research
due
to
the
early
invention
and
adoption
of
bubble
sheets.
invention
and
adoption
of
bubble
sheets.
...
...
common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml
View file @
2caa5a51
...
@@ -3,8 +3,8 @@ metadata:
...
@@ -3,8 +3,8 @@ metadata:
display_name
:
Numerical Response
display_name
:
Numerical Response
rerandomize
:
never
rerandomize
:
never
showanswer
:
always
showanswer
:
always
markdown
:
"
markdown
:
A
numerical
response
problem
accepts
a
line
of
text
input
from
the
"
A
numerical
response
problem
accepts
a
line
of
text
input
from
the
student,
and
evaluates
the
input
for
correctness
based
on
its
student,
and
evaluates
the
input
for
correctness
based
on
its
numerical
value.
numerical
value.
...
...
common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml
View file @
2caa5a51
...
@@ -3,8 +3,8 @@ metadata:
...
@@ -3,8 +3,8 @@ metadata:
display_name
:
Option Response
display_name
:
Option Response
rerandomize
:
never
rerandomize
:
never
showanswer
:
always
showanswer
:
always
markdown
:
"
markdown
:
OptionResponse
gives
a
limited
set
of
options
for
students
to
respond
with,
and
presents
those
options
"
OptionResponse
gives
a
limited
set
of
options
for
students
to
respond
with,
and
presents
those
options
in
a
format
that
encourages
them
to
search
for
a
specific
answer
rather
than
being
immediately
presented
in
a
format
that
encourages
them
to
search
for
a
specific
answer
rather
than
being
immediately
presented
with
options
from
which
to
recognize
the
correct
answer.
with
options
from
which
to
recognize
the
correct
answer.
...
...
common/lib/xmodule/xmodule/templates/problem/string_response.yaml
View file @
2caa5a51
...
@@ -4,8 +4,8 @@ metadata:
...
@@ -4,8 +4,8 @@ metadata:
rerandomize
:
never
rerandomize
:
never
showanswer
:
always
showanswer
:
always
# Note, the extra newlines are needed to make the yaml parser add blank lines instead of folding
# Note, the extra newlines are needed to make the yaml parser add blank lines instead of folding
markdown
:
"
markdown
:
A
string
response
problem
accepts
a
line
of
text
input
from
the
"
A
string
response
problem
accepts
a
line
of
text
input
from
the
student,
and
evaluates
the
input
for
correctness
based
on
an
expected
student,
and
evaluates
the
input
for
correctness
based
on
an
expected
answer
within
each
input
box.
answer
within
each
input
box.
...
...
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