Embedded discussions displayed with the new style but without replying yet.

Needs different CSS to make it more appropriate in the embedded view.
This commit is contained in:
Ibrahim Awwal
2012-09-04 01:13:55 -07:00
parent 6bae16098f
commit 32ccf51e97
8 changed files with 41 additions and 38 deletions

View File

@@ -23,12 +23,17 @@ if Backbone?
type: "GET"
dataType: 'json'
success: (response, textStatus) =>
@$el.append(response.html)
$discussion = @$el.find("section.discussion")
#@$el.append(response.html)
window.user = new DiscussionUser(response.user_info)
$(event.target).html("Hide Discussion")
discussion = new Discussion()
discussion.reset(response.discussion_data, {silent: false})
view = new DiscussionView(el: $discussion[0], model: discussion)
$discussion = $(Mustache.render $("script#_inline_discussion").html(), {'threads':response.discussion_data})
$(".discussion-module").append($discussion)
discussion.each (thread) ->
element = $("article#thread_#{thread.id}")
dtv = new DiscussionThreadView el: element, model: thread
dtv.render()
DiscussionUtil.bulkUpdateContentInfo(window.$$annotated_content_info)
@retrieved = true
@showed = true

View File

@@ -1,4 +1,6 @@
$ ->
if !window.$$contents
window.$$contents = {}
$.fn.extend
loading: ->
@$_loading = $("<span class='discussion-loading'></span>")

View File

@@ -29,7 +29,7 @@ class @DiscussionThreadView extends Backbone.View
renderResponses: ->
DiscussionUtil.safeAjax
url: @model.id
url: "/courses/#{$$course_id}/discussion/forum/#{@model.get('commentable_id')}/threads/#{@model.id}"
success: (data, textStatus, xhr) =>
@$(".loading").remove()
comments = new Comments(data['content']['children'])

View File

@@ -1389,13 +1389,6 @@ body.discussion {
.global-discussion-actions {
height: 60px;
@include linear-gradient(top, #ebebeb, #d9d9d9);
@@ -1403,21 +1396,13 @@ body.discussion {
border-bottom: 1px solid #bcbcbc;
}
.discussion-module {
@extend .discussion-body
}
/* For some reason I have to do this to get the SCSS to compile, can't stick it under the above .discussion-module */
.discussion-module {
.discussion-reply-new {
display:none
}
}