Commit 0022efb7 by Ibrahim Awwal

Add loading animation to discussion module.

parent 366e9c67
...@@ -3,7 +3,7 @@ $ -> ...@@ -3,7 +3,7 @@ $ ->
window.$$contents = {} window.$$contents = {}
$.fn.extend $.fn.extend
loading: -> loading: ->
@$_loading = $("<span class='discussion-loading'></span>") @$_loading = $("<div class='loading-animation'></div>")
$(this).after(@$_loading) $(this).after(@$_loading)
loaded: -> loaded: ->
@$_loading.remove() @$_loading.remove()
......
...@@ -34,8 +34,6 @@ class @DiscussionThreadInlineView extends DiscussionContentView ...@@ -34,8 +34,6 @@ class @DiscussionThreadInlineView extends DiscussionContentView
if @expanded if @expanded
@makeWmdEditor "reply-body" @makeWmdEditor "reply-body"
@renderResponses() @renderResponses()
# @highlight @$(".post-body")
# @highlight @$("h1")
@ @
renderDogear: -> renderDogear: ->
...@@ -60,6 +58,7 @@ class @DiscussionThreadInlineView extends DiscussionContentView ...@@ -60,6 +58,7 @@ class @DiscussionThreadInlineView extends DiscussionContentView
renderResponses: -> renderResponses: ->
DiscussionUtil.safeAjax DiscussionUtil.safeAjax
url: "/courses/#{$$course_id}/discussion/forum/#{@model.get('commentable_id')}/threads/#{@model.id}" url: "/courses/#{$$course_id}/discussion/forum/#{@model.get('commentable_id')}/threads/#{@model.id}"
$loading: @$el
success: (data, textStatus, xhr) => success: (data, textStatus, xhr) =>
@$el.find(".loading").remove() @$el.find(".loading").remove()
Content.loadContentInfos(data['annotated_content_info']) Content.loadContentInfos(data['annotated_content_info'])
...@@ -188,11 +187,8 @@ class @DiscussionThreadInlineView extends DiscussionContentView ...@@ -188,11 +187,8 @@ class @DiscussionThreadInlineView extends DiscussionContentView
success: (response, textStatus) => success: (response, textStatus) =>
@model.set('endorsed', not endorsed) @model.set('endorsed', not endorsed)
highlight: (el) ->
el.html(el.html().replace(/&lt;mark&gt;/g, "<mark>").replace(/&lt;\/mark&gt;/g, "</mark>"))
abbreviateBody: -> abbreviateBody: ->
abbreviated = DiscussionUtil.abbreviateString @model.get('body'), 140 # Because twitter abbreviated = DiscussionUtil.abbreviateString @model.get('body'), 140
@model.set('abbreviatedBody', abbreviated) @model.set('abbreviatedBody', abbreviated)
expandPost: (event) -> expandPost: (event) ->
......
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