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
45e4c0cf
Commit
45e4c0cf
authored
Feb 05, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved discussion thread html to its own template and only scroll when not in view.
parent
3136d2b4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
12 deletions
+35
-12
common/lib/xmodule/xmodule/annotatable_module.py
+5
-9
common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
+24
-3
lms/templates/annotatable_discussion.html
+6
-0
No files found.
common/lib/xmodule/xmodule/annotatable_module.py
View file @
45e4c0cf
...
...
@@ -63,15 +63,11 @@ class AnnotatableModule(XModule):
def
_get_discussion_html
(
self
,
discussion_id
,
discussion_title
):
""" Returns html to display the discussion thread """
tpl
=
u'<div class="annotatable-discussion" data-discussion-id="{0}">'
tpl
+=
'<div class="annotatable-icon"> </div>'
tpl
+=
'<span class="annotatable-discussion-label">Guided Discussion: </span>'
tpl
+=
'<span class="annotatable-discussion-thread">{1}</span>'
tpl
+=
'<a class="annotatable-show-discussion" href="javascript:void(0);">Show Discussion</a>'
tpl
+=
'</div>'
return
tpl
.
format
(
discussion_id
,
discussion_title
)
context
=
{
'discussion_id'
:
discussion_id
,
'discussion_title'
:
discussion_title
}
return
self
.
system
.
render_template
(
'annotatable_discussion.html'
,
context
)
def
_attach_discussion
(
self
,
span
,
index
,
xmltree
):
""" Attaches a discussion thread to the annotation span. """
...
...
common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
View file @
45e4c0cf
...
...
@@ -59,13 +59,34 @@ class @Annotatable
$
(
@
discussionSelector
,
@
el
).
not
(
el
).
toggleClass
(
'opaque'
,
state
)
scrollToDiscussion
:
(
el
)
->
padding
=
20
complete
=
@
makeHighlighter
(
el
)
top
=
el
.
offset
().
top
-
20
# with some padding
animOpts
=
{
scrollTop
:
el
.
offset
().
top
-
padding
}
if
@
canScrollToDiscussion
(
el
)
$
(
'html, body'
).
animate
(
animOpts
,
500
,
'swing'
,
complete
)
else
complete
()
canScrollToDiscussion
:
(
el
)
->
scrollTop
=
el
.
offset
().
top
docHeight
=
$
(
document
).
height
()
winHeight
=
$
(
window
).
height
()
winScrollTop
=
window
.
scrollY
viewStart
=
winScrollTop
viewEnd
=
winScrollTop
+
(.
75
*
winHeight
)
inView
=
viewStart
<
scrollTop
<
viewEnd
scrollable
=
!
inView
atDocEnd
=
viewStart
+
winHeight
>=
docHeight
$
(
'html, body'
).
animate
({
scrollTop
:
top
},
750
,
'swing'
,
complet
e
)
return
(
if
atDocEnd
then
false
else
scrollabl
e
)
makeHighlighter
:
(
el
)
->
return
@
_once
->
el
.
effect
(
'highlight'
,
{},
75
0
)
return
@
_once
->
el
.
effect
(
'highlight'
,
{},
50
0
)
_once
:
(
fn
)
->
done
=
false
...
...
lms/templates/annotatable_discussion.html
0 → 100644
View file @
45e4c0cf
<div
class=
"annotatable-discussion"
data-discussion-id=
"${discussion_id}"
>
<div
class=
"annotatable-icon"
>
</div>
<span
class=
"annotatable-discussion-label"
>
Guided Discussion:
</span>
<span
class=
"annotatable-discussion-thread"
>
${discussion_title}
</span>
<a
class=
"annotatable-show-discussion"
href=
"javascript:void(0);"
>
Show Discussion
</a>
</div>
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