diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index 79911a38bc..48d59436d9 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -9,7 +9,9 @@ from django.utils import simplejson from django.db import connection from django.conf import settings from django.core.urlresolvers import reverse +from django.contrib.auth.models import User from django_comment_client.permissions import check_permissions_by_view +from django_comment_client.models import Role from mitxmako import middleware import logging @@ -226,11 +228,15 @@ def permalink(content): args=[content['course_id'], content['commentable_id'], content['thread_id']]) + '#' + content['id'] def extend_content(content): + user = User.objects.get(pk=content['user_id']) + roles = dict(('name', role.name.lower()) for role in user.roles.filter(course_id=content['course_id'])) content_info = { 'displayed_title': content.get('highlighted_title') or content.get('title', ''), 'displayed_body': content.get('highlighted_body') or content.get('body', ''), 'raw_tags': ','.join(content.get('tags', [])), 'permalink': permalink(content), + 'roles': roles, + 'updated': content['created_at']!=content['updated_at'], } return merge_dict(content, content_info) diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index 73c3688c2a..9f95c201f4 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -374,6 +374,9 @@ if Backbone? MathJax.Hub.Queue ["Typeset", MathJax.Hub, $contentBody.attr("id")] initTimeago: -> + @$("span.timeago").each (index, element) -> + elem = $(element) + elem.html("posted on #{$.timeago.parse(elem.html()).toLocaleString()}") @$("span.timeago").timeago() renderPartial: -> diff --git a/lms/static/sass/_discussion.scss b/lms/static/sass/_discussion.scss index b00dc069f1..6d44ebdb68 100644 --- a/lms/static/sass/_discussion.scss +++ b/lms/static/sass/_discussion.scss @@ -390,6 +390,14 @@ $tag-text-color: #5b614f; color: #dea03e; } } + + .author-moderator:after{ + content: " (moderator)" + } + + .author-administrator:after{ + content: " (instructor)" + } } .discussion-content { @@ -415,6 +423,13 @@ $tag-text-color: #5b614f; } } + // Role based styles + .role-moderator{ + background-color: #eafcfc; + } + .role-administrator{ + background-color: #eafcea; + } //COMMENT STYLES .comments { overflow: hidden; diff --git a/lms/templates/discussion/mustache/_content.mustache b/lms/templates/discussion/mustache/_content.mustache index 88f53a23ac..8f2ebca2a9 100644 --- a/lms/templates/discussion/mustache/_content.mustache +++ b/lms/templates/discussion/mustache/_content.mustache @@ -1,4 +1,4 @@ -