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
c3f55845
Commit
c3f55845
authored
Feb 22, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
factoring out discussion logic (for now, anyway)
parent
66ddfa29
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
21 deletions
+9
-21
common/lib/capa/capa/inputtypes.py
+2
-0
common/lib/capa/capa/templates/annotationinput.html
+2
-0
common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
+5
-21
No files found.
common/lib/capa/capa/inputtypes.py
View file @
c3f55845
...
@@ -980,6 +980,7 @@ class AnnotationInput(InputTypeBase):
...
@@ -980,6 +980,7 @@ class AnnotationInput(InputTypeBase):
self
.
comment_prompt
=
xml
.
findtext
(
'./comment_prompt'
,
'Type a commentary below:'
)
self
.
comment_prompt
=
xml
.
findtext
(
'./comment_prompt'
,
'Type a commentary below:'
)
self
.
tag_prompt
=
xml
.
findtext
(
'./tag_prompt'
,
'Select one or more tags:'
)
self
.
tag_prompt
=
xml
.
findtext
(
'./tag_prompt'
,
'Select one or more tags:'
)
self
.
options
=
self
.
_find_options
()
self
.
options
=
self
.
_find_options
()
self
.
return_to_annotation
=
True
# Need to provide a value that JSON can parse if there is no
# Need to provide a value that JSON can parse if there is no
# student-supplied value yet.
# student-supplied value yet.
...
@@ -1024,6 +1025,7 @@ class AnnotationInput(InputTypeBase):
...
@@ -1024,6 +1025,7 @@ class AnnotationInput(InputTypeBase):
'comment_prompt'
:
self
.
comment_prompt
,
'comment_prompt'
:
self
.
comment_prompt
,
'tag_prompt'
:
self
.
tag_prompt
,
'tag_prompt'
:
self
.
tag_prompt
,
'options'
:
self
.
options
,
'options'
:
self
.
options
,
'return_to_annotation'
:
self
.
return_to_annotation
,
'debug'
:
self
.
debug
'debug'
:
self
.
debug
}
}
unpacked_value
=
self
.
_unpack_value
()
unpacked_value
=
self
.
_unpack_value
()
...
...
common/lib/capa/capa/templates/annotationinput.html
View file @
c3f55845
...
@@ -44,7 +44,9 @@
...
@@ -44,7 +44,9 @@
<span
class=
"incorrect"
id=
"status_${id}"
></span>
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% endif
% endif
% if return_to_annotation:
<a
class=
"annotation-return"
href=
"javascript:void(0)"
>
Return to Annotation
</a><br/>
<a
class=
"annotation-return"
href=
"javascript:void(0)"
>
Return to Annotation
</a><br/>
% endif
</div>
</div>
</form>
</form>
...
...
common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
View file @
c3f55845
class
@
Annotatable
class
@
Annotatable
_debug
:
tru
e
_debug
:
fals
e
wrapperSelector
:
'.annotatable-wrapper'
wrapperSelector
:
'.annotatable-wrapper'
toggleSelector
:
'.annotatable-toggle'
toggleSelector
:
'.annotatable-toggle'
...
@@ -8,11 +8,9 @@ class @Annotatable
...
@@ -8,11 +8,9 @@ class @Annotatable
problemXModuleSelector
:
'.xmodule_CapaModule'
problemXModuleSelector
:
'.xmodule_CapaModule'
problemSelector
:
'section.problem'
problemSelector
:
'section.problem'
problemInputSelector
:
'.annotation-input'
problemReturnSelector
:
'section.problem .annotation-return'
problemReturnSelector
:
'section.problem .annotation-return'
discussionXModuleSelector
:
'.xmodule_DiscussionModule'
discussionSelector
:
'.discussion-module'
constructor
:
(
el
)
->
constructor
:
(
el
)
->
console
.
log
'loaded Annotatable'
if
@
_debug
console
.
log
'loaded Annotatable'
if
@
_debug
@
el
=
el
@
el
=
el
...
@@ -24,7 +22,6 @@ class @Annotatable
...
@@ -24,7 +22,6 @@ class @Annotatable
init
:
()
->
init
:
()
->
@
initEvents
()
@
initEvents
()
@
initTips
()
@
initTips
()
@
initDiscussion
()
initEvents
:
()
->
initEvents
:
()
->
# For handling hide/show of annotations
# For handling hide/show of annotations
...
@@ -36,15 +33,13 @@ class @Annotatable
...
@@ -36,15 +33,13 @@ class @Annotatable
# (see the qtip2 options, this must be set explicitly, otherwise they render in the body).
# (see the qtip2 options, this must be set explicitly, otherwise they render in the body).
@
$
(
@
wrapperSelector
).
delegate
@
replySelector
,
'click'
,
@
onClickReply
@
$
(
@
wrapperSelector
).
delegate
@
replySelector
,
'click'
,
@
onClickReply
#
This is a silly hack, but it assumes two things
:
#
For handling 'return to annotation' events from capa problems. Assumes that
:
# 1) There are annotationinput capa problems rendered on the page
# 1) There are annotationinput capa problems rendered on the page
# 2) Each one has
its an embedded "return to annotation" link
.
# 2) Each one has
an embedded "return to annotation" link (from the capa problem template)
.
# The capa problem's html is injected via AJAX so this just sets a listener on the body and
# The capa problem's html is injected via AJAX so this just sets a listener on the body and
# handles the click event there.
# handles the click event there.
$
(
'body'
).
delegate
@
problemReturnSelector
,
'click'
,
@
onClickReturn
$
(
'body'
).
delegate
@
problemReturnSelector
,
'click'
,
@
onClickReturn
initDiscussion
:
()
->
1
initTips
:
()
->
initTips
:
()
->
@
savedTips
=
[]
@
savedTips
=
[]
@
$
(
@
spanSelector
).
each
(
index
,
el
)
=>
@
$
(
@
spanSelector
).
each
(
index
,
el
)
=>
...
@@ -103,18 +98,11 @@ class @Annotatable
...
@@ -103,18 +98,11 @@ class @Annotatable
getProblem
:
(
el
)
->
getProblem
:
(
el
)
->
problem_id
=
@
getProblemId
(
el
)
problem_id
=
@
getProblemId
(
el
)
$
(
@
problemSelector
).
eq
(
problem_id
)
$
(
@
problemSelector
).
has
(
@
problemInputSelector
).
eq
(
problem_id
)
getDiscussion
:
()
->
discussion_id
=
@
getDiscussionId
()
$
(
@
discussionXModuleSelector
).
find
(
@
discussionSelector
).
filter
(
"[data-discussion-id='
#{
discussion_id
}
']"
)
getProblemId
:
(
el
)
->
getProblemId
:
(
el
)
->
$
(
el
).
data
(
'problem-id'
)
$
(
el
).
data
(
'problem-id'
)
getDiscussionId
:
()
->
@
$
(
@
wrapperSelector
).
data
(
'discussion-id'
)
toggleAnnotations
:
()
->
toggleAnnotations
:
()
->
hide
=
(
@
annotationsHidden
=
not
@
annotationsHidden
)
hide
=
(
@
annotationsHidden
=
not
@
annotationsHidden
)
@
toggleButtonText
hide
@
toggleButtonText
hide
...
@@ -142,10 +130,6 @@ class @Annotatable
...
@@ -142,10 +130,6 @@ class @Annotatable
offset
:
offset
offset
:
offset
})
if
$
(
el
).
length
>
0
})
if
$
(
el
).
length
>
0
afterScrollToDiscussion
:
(
discussion_el
)
->
btn
=
$
(
'.discussion-show'
,
discussion_el
)
btn
.
click
()
if
!
btn
.
hasClass
(
'shown'
)
afterScrollToProblem
:
(
problem_el
)
->
afterScrollToProblem
:
(
problem_el
)
->
problem_el
.
effect
'highlight'
,
{},
500
problem_el
.
effect
'highlight'
,
{},
500
...
...
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