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
949603e3
Commit
949603e3
authored
Feb 13, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with return link and scroll after effects.
parent
6b5bf319
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
+22
-16
No files found.
common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
View file @
949603e3
...
@@ -6,10 +6,11 @@ class @Annotatable
...
@@ -6,10 +6,11 @@ class @Annotatable
spanSelector
:
'.annotatable-span'
spanSelector
:
'.annotatable-span'
commentSelector
:
'.annotatable-comment'
commentSelector
:
'.annotatable-comment'
replySelector
:
'.annotatable-reply'
replySelector
:
'.annotatable-reply'
returnSelector
:
'.annotatable-return'
helpSelector
:
'.annotatable-help-icon'
helpSelector
:
'.annotatable-help-icon'
returnSelector
:
'.annotatable-return'
discussionXModuleSelector
:
'.xmodule_DiscussionModule'
discussionXModuleSelector
:
'.xmodule_DiscussionModule'
discussionSelector
:
'.discussion-module'
discussionSelector
:
'.discussion-module'
constructor
:
(
el
)
->
constructor
:
(
el
)
->
console
.
log
'loaded Annotatable'
if
@
_debug
console
.
log
'loaded Annotatable'
if
@
_debug
...
@@ -82,7 +83,8 @@ class @Annotatable
...
@@ -82,7 +83,8 @@ class @Annotatable
onClickReturn
:
(
e
)
=>
onClickReturn
:
(
e
)
=>
e
.
preventDefault
()
e
.
preventDefault
()
@
scrollTo
(
@
getSpan
e
.
currentTarget
,
@
afterScrollToSpan
)
span_el
=
@
getSpan
e
.
currentTarget
@
scrollTo
(
span_el
,
@
afterScrollToSpan
)
getSpan
:
(
el
)
->
getSpan
:
(
el
)
->
discussion_id
=
@
getDiscussionId
(
el
)
discussion_id
=
@
getDiscussionId
(
el
)
...
@@ -96,34 +98,38 @@ class @Annotatable
...
@@ -96,34 +98,38 @@ class @Annotatable
$
(
el
).
data
(
'discussion-id'
)
$
(
el
).
data
(
'discussion-id'
)
toggleAnnotations
:
()
->
toggleAnnotations
:
()
->
@
annotationsHidden
=
not
@
annotationsHidden
hide
=
(
@
annotationsHidden
=
not
@
annotationsHidden
)
@
toggleButtonText
@
annotationsHidden
@
toggleButtonText
hide
@
toggleSpans
@
annotationsHidden
@
toggleSpans
hide
@
toggleTips
@
annotationsHidden
@
toggleReturnLinks
hide
@
toggleTips
hide
toggleTips
:
(
hide
)
->
toggleTips
:
(
hide
)
->
if
hide
then
@
closeAndSaveTips
()
else
@
openSavedTips
()
if
hide
then
@
closeAndSaveTips
()
else
@
openSavedTips
()
toggleReturnLinks
:
(
hide
)
->
$
(
@
returnSelector
)[
if
hide
then
'hide'
else
'show'
]()
toggleButtonText
:
(
hide
)
->
toggleButtonText
:
(
hide
)
->
buttonText
=
(
if
hide
then
'Show'
else
'Hide'
)
+
' Annotations'
buttonText
=
(
if
hide
then
'Show'
else
'Hide'
)
+
' Annotations'
@
$
(
@
toggleSelector
).
text
(
buttonText
)
@
$
(
@
toggleSelector
).
text
(
buttonText
)
toggleSpans
:
(
hide
)
->
toggleSpans
:
(
hide
)
->
@
$
(
@
spanSelector
).
toggleClass
'hide'
,
hide
@
$
(
@
spanSelector
).
toggleClass
'hide'
,
hide
,
250
scrollTo
:
(
el
,
after
)
->
scrollTo
:
(
el
,
after
=
->
true
)
->
$
(
'html,body'
).
scrollTo
(
el
,
{
$
(
'html,body'
).
scrollTo
(
el
,
{
duration
:
500
duration
:
500
#onAfter: @_once => after.call this, el
onAfter
:
@
_once
=>
after
.
call
this
,
el
offset
:
-
20
})
})
afterScrollToDiscussion
:
()
->
afterScrollToDiscussion
:
(
el
)
->
(
el
)
->
btn
=
$
(
'.discussion-show'
,
el
)
btn
=
$
(
'.discussion-show'
,
el
)
btn
.
click
()
if
!
btn
.
hasClass
(
'shown'
)
btn
.
click
()
if
!
btn
.
hasClass
(
'shown'
)
afterScrollToSpan
:
(
el
)
->
afterScrollToSpan
:
(
el
)
->
(
el
)
->
el
.
effect
(
'highlight'
,
{},
500
)
el
.
effect
'highlight'
,
{
color
:
'rgba(0,0,0,0.5)'
},
1000
makeTipContent
:
(
el
)
->
makeTipContent
:
(
el
)
->
(
api
)
=>
(
api
)
=>
...
@@ -142,7 +148,7 @@ class @Annotatable
...
@@ -142,7 +148,7 @@ class @Annotatable
$
(
"<a class=
\"
annotatable-reply
\"
href=
\"
javascript:void(0);
\"
data-discussion-id=
\"
#{
discussion_id
}
\"
>See Full Discussion</a>"
)
$
(
"<a class=
\"
annotatable-reply
\"
href=
\"
javascript:void(0);
\"
data-discussion-id=
\"
#{
discussion_id
}
\"
>See Full Discussion</a>"
)
createReturnLink
:
(
discussion_id
)
->
createReturnLink
:
(
discussion_id
)
->
$
(
"<a class=
\"
annotatable-return
button
\"
href=
\"
javascript:void(0);
\"
data-discussion-id=
\"
#{
discussion_id
}
\"
>Return to annotation</a>"
)
$
(
"<a class=
\"
annotatable-return
\"
href=
\"
javascript:void(0);
\"
data-discussion-id=
\"
#{
discussion_id
}
\"
>Return to annotation</a>"
)
openSavedTips
:
()
->
openSavedTips
:
()
->
@
showTips
@
savedTips
@
showTips
@
savedTips
...
...
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