Commit 2848df82 by Arthur Barrett

Style changes to comments: increase font size, width. Improved scrolling between…

Style changes to comments: increase font size, width. Improved scrolling between spans and discussions.
parent 010593be
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
} }
.ui-tooltip.qtip.ui-tooltip-annotatable { .ui-tooltip.qtip.ui-tooltip-annotatable {
max-width: 350px; max-width: 375px;
.ui-tooltip-title:before { .ui-tooltip-title:before {
font-weight: normal; font-weight: normal;
content: "Guided Discussion: "; content: "Guided Discussion: ";
...@@ -110,8 +110,8 @@ ...@@ -110,8 +110,8 @@
.annotatable-comment { .annotatable-comment {
display: block; display: block;
margin: 0px 0px 10px 0; margin: 0px 0px 10px 0;
max-height: 175px; max-height: 225px; // truncate the text via JS so we can get an ellipsis
overflow: hidden; overflow: auto;
} }
.annotatable-reply { .annotatable-reply {
display: block; display: block;
......
...@@ -11,7 +11,9 @@ class @Annotatable ...@@ -11,7 +11,9 @@ class @Annotatable
discussionXModuleSelector: '.xmodule_DiscussionModule' discussionXModuleSelector: '.xmodule_DiscussionModule'
discussionSelector: '.discussion-module' discussionSelector: '.discussion-module'
commentMaxLength: 750 # Max length characters to show in the comment hover state
constructor: (el) -> constructor: (el) ->
console.log 'loaded Annotatable' if @_debug console.log 'loaded Annotatable' if @_debug
@el = el @el = el
...@@ -84,7 +86,8 @@ class @Annotatable ...@@ -84,7 +86,8 @@ class @Annotatable
onClickReturn: (e) => onClickReturn: (e) =>
e.preventDefault() e.preventDefault()
span_el = @getSpan e.currentTarget span_el = @getSpan e.currentTarget
@scrollTo(span_el, @afterScrollToSpan) offset = -200
@scrollTo(span_el, @afterScrollToSpan, offset)
getSpan: (el) -> getSpan: (el) ->
discussion_id = @getDiscussionId(el) discussion_id = @getDiscussionId(el)
...@@ -117,11 +120,11 @@ class @Annotatable ...@@ -117,11 +120,11 @@ class @Annotatable
toggleSpans: (hide) -> toggleSpans: (hide) ->
@$(@spanSelector).toggleClass 'hide', hide, 250 @$(@spanSelector).toggleClass 'hide', hide, 250
scrollTo: (el, after = -> true) -> scrollTo: (el, after, offset = -20) ->
$('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 offset: offset
}) })
afterScrollToDiscussion: (el) -> afterScrollToDiscussion: (el) ->
...@@ -135,7 +138,10 @@ class @Annotatable ...@@ -135,7 +138,10 @@ class @Annotatable
(api) => (api) =>
discussion_id = @getDiscussionId(el) discussion_id = @getDiscussionId(el)
comment = $(@commentSelector, el).first().clone() comment = $(@commentSelector, el).first().clone()
comment = comment.after(@createReplyLink discussion_id) if discussion_id text = @_truncate comment.text().trim(), @commentMaxLength
comment.text(text)
if discussion_id
comment = comment.after(@createReplyLink discussion_id)
comment comment
makeTipTitle: (el) -> makeTipTitle: (el) ->
...@@ -182,3 +188,9 @@ class @Annotatable ...@@ -182,3 +188,9 @@ class @Annotatable
return => return =>
fn.call this unless done fn.call this unless done
done = true done = true
_truncate: (text = '', limit) ->
if text.length > limit
text.substring(0, limit - 1).split(' ').slice(0, -1).join(' ') + '...' # truncate on word boundary
else
text
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment