Commit 14b0cc01 by Kevin Chugh

remove debug placeholders, finalize render of comments, flagging working on…

remove debug placeholders, finalize render of comments, flagging working on posts, replies, and comments
parent deb3888a
...@@ -72,7 +72,6 @@ def inline_discussion(request, course_id, discussion_id): ...@@ -72,7 +72,6 @@ def inline_discussion(request, course_id, discussion_id):
""" """
Renders JSON for DiscussionModules Renders JSON for DiscussionModules
""" """
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load')
try: try:
...@@ -179,6 +178,8 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -179,6 +178,8 @@ def single_thread(request, course_id, discussion_id, thread_id):
# TODO: Remove completely or switch back to server side rendering # TODO: Remove completely or switch back to server side rendering
# html = render_to_string('discussion/_ajax_single_thread.html', context) # html = render_to_string('discussion/_ajax_single_thread.html', context)
content = utils.safe_content(thread.to_dict()) content = utils.safe_content(thread.to_dict())
log.debug("*************************")
log.debug(content)
if courseware_context: if courseware_context:
content.update(courseware_context) content.update(courseware_context)
return utils.JsonResponse({ return utils.JsonResponse({
......
if Backbone? if Backbone?
class @ResponseCommentShowView extends DiscussionContentView class @ResponseCommentShowView extends DiscussionContentView
events: events:
"click .discussion-flag-abuse": "toggleFlagAbuse" "click .discussion-flag-abuse": "toggleFlagAbuse"
tagName: "li" tagName: "li"
initialize: ->
super()
@model.on "change", @updateModelDetails
render: -> render: ->
@template = _.template($("#response-comment-show-template").html()) @template = _.template($("#response-comment-show-template").html())
...@@ -14,6 +18,7 @@ if Backbone? ...@@ -14,6 +18,7 @@ if Backbone?
@initLocal() @initLocal()
@delegateEvents() @delegateEvents()
@renderAttrs() @renderAttrs()
@renderFlagged()
@markAsStaff() @markAsStaff()
@$el.find(".timeago").timeago() @$el.find(".timeago").timeago()
@convertMath() @convertMath()
...@@ -45,6 +50,9 @@ if Backbone? ...@@ -45,6 +50,9 @@ if Backbone?
@$("[data-role=thread-flag]").removeClass("notflagged") @$("[data-role=thread-flag]").removeClass("notflagged")
else else
@$("[data-role=thread-flag]").removeClass("flagged") @$("[data-role=thread-flag]").removeClass("flagged")
@$("[data-role=thread-flag]").addClass("notflagged") @$("[data-role=thread-flag]").addClass("notflagged")
updateModelDetails: =>
@renderFlagged()
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
</header> </header>
<div class="post-body">${'<%- body %>'}</div> <div class="post-body">${'<%- body %>'}</div>
POST
<div class="discussion-flag-abuse notflagged" data-role="thread-flag" data-tooltip="flag"> <div class="discussion-flag-abuse notflagged" data-role="thread-flag" data-tooltip="flag">
<i class="icon"></i><span class="flag-label">Report Misuse</span></div> <i class="icon"></i><span class="flag-label">Report Misuse</span></div>
...@@ -111,7 +110,6 @@ ...@@ -111,7 +110,6 @@
<p class="posted-details" title="${'<%- created_at %>'}">${'<%- created_at %>'}</p> <p class="posted-details" title="${'<%- created_at %>'}">${'<%- created_at %>'}</p>
</header> </header>
<div class="response-local"><div class="response-body">${"<%- body %>"}</div> <div class="response-local"><div class="response-body">${"<%- body %>"}</div>
RESPONSE
<div class="discussion-flag-abuse notflagged" data-role="thread-flag" data-tooltip="flag"> <div class="discussion-flag-abuse notflagged" data-role="thread-flag" data-tooltip="flag">
<i class="icon"></i><span class="flag-label">Report Misuse</span></div> <i class="icon"></i><span class="flag-label">Report Misuse</span></div>
</div> </div>
...@@ -137,9 +135,8 @@ ...@@ -137,9 +135,8 @@
<script type="text/template" id="response-comment-show-template"> <script type="text/template" id="response-comment-show-template">
<div id="comment_${'<%- id %>'}"> <div id="comment_${'<%- id %>'}">
<div class="response-body">${'<%- body %>'}</div> <div class="response-body">${'<%- body %>'}</div>
COMMENT
<div class="discussion-flag-abuse notflagged" data-role="thread-flag" data-tooltip="flag"> <div class="discussion-flag-abuse notflagged" data-role="thread-flag" data-tooltip="flag">
<i class="icon"></i><span class="flag-label">Report Misuse</span></div> <i class="icon"></i><span class="flag-label"></span></div>
<p class="posted-details">&ndash;posted <span class="timeago" title="${'<%- created_at %>'}">${'<%- created_at %>'}</span> by <p class="posted-details">&ndash;posted <span class="timeago" title="${'<%- created_at %>'}">${'<%- created_at %>'}</span> by
${"<% if (obj.username) { %>"} ${"<% if (obj.username) { %>"}
<a href="${'<%- user_url %>'}" class="profile-link">${'<%- username %>'}</a> <a href="${'<%- user_url %>'}" class="profile-link">${'<%- username %>'}</a>
......
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