From fb6a07c812748916061109ac1aa4f807a1069652 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 16 Nov 2012 18:39:54 -0500 Subject: [PATCH] allow flagging for abuse and spoilers --- lms/lib/comment_client/comment.py | 2 +- lms/lib/comment_client/thread.py | 2 +- lms/static/coffee/src/discussion/content.coffee | 12 ++++++++++-- lms/templates/discussion/_underscore_templates.html | 5 ++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lms/lib/comment_client/comment.py b/lms/lib/comment_client/comment.py index 6d0bafee02..5d49c0a869 100644 --- a/lms/lib/comment_client/comment.py +++ b/lms/lib/comment_client/comment.py @@ -10,7 +10,7 @@ class Comment(models.Model): 'id', 'body', 'anonymous', 'anonymous_to_peers', 'course_id', 'endorsed', 'parent_id', 'thread_id', 'username', 'votes', 'user_id', 'closed', 'created_at', 'updated_at', 'depth', 'at_position_list', - 'type', 'commentable_id', + 'type', 'commentable_id', 'abuse_flaggers', 'spoiler_flaggers' ] updatable_fields = [ diff --git a/lms/lib/comment_client/thread.py b/lms/lib/comment_client/thread.py index 424250033e..4246aabe21 100644 --- a/lms/lib/comment_client/thread.py +++ b/lms/lib/comment_client/thread.py @@ -10,7 +10,7 @@ class Thread(models.Model): 'closed', 'tags', 'votes', 'commentable_id', 'username', 'user_id', 'created_at', 'updated_at', 'comments_count', 'unread_comments_count', 'at_position_list', 'children', 'type', 'highlighted_title', - 'highlighted_body', 'endorsed', 'read' + 'highlighted_body', 'endorsed', 'read', 'abuse_flaggers', 'spoiler_flaggers' ] updatable_fields = [ diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index 4e612dfc40..0e86064bf2 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -78,7 +78,8 @@ if Backbone? if @getContent(id) @getContent(id).updateInfo(info) $.extend @contentInfos, infos - + + class @Thread extends @Content urlMappers: 'retrieve' : -> DiscussionUtil.urlFor('retrieve_single_thread', @discussion.id, @id) @@ -119,7 +120,13 @@ if Backbone? else @get("body") - display_title: -> + display_tigetCommentsCount: -> + count = 0 + @get('comments').each (comment) -> + count += comment.getCommentsCount() + 1 + count + + class @Comments extends Backbtle: -> if @has("highlighted_title") String(@get("highlighted_title")).replace(//g, '').replace(/<\/highlight>/g, '') else @@ -134,6 +141,7 @@ if Backbone? created_at_time: -> new Date(@get("created_at")).getTime() + class @Comment extends @Content urlMappers: diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index be238811c2..7c14e5af17 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -26,7 +26,10 @@
- + ${'<%- votes["up_count"] %>'} + + + ${'<%- votes["up_count"] %>'} + + + ${'<%- abuse_flaggers.length%>'}

${'<%- title %>'}

${"<% if (obj.username) { %>"}