diff --git a/lms/djangoapps/django_comment_client/helpers.py b/lms/djangoapps/django_comment_client/helpers.py index 7c98aa4742..bb3bac0926 100644 --- a/lms/djangoapps/django_comment_client/helpers.py +++ b/lms/djangoapps/django_comment_client/helpers.py @@ -1,5 +1,6 @@ from django.core.urlresolvers import reverse from mitxmako.shortcuts import render_to_string +from utils import render_mustache import urllib def pluralize(singular_term, count): @@ -26,4 +27,7 @@ def url_for_tags(course_id, tags): return reverse('django_comment_client.forum.views.forum_form_discussion', args=[course_id]) + '?' + urllib.urlencode({'tags': ",".join(tags)}) def render_content(content): - return render_to_string('discussion/_content.html', {'content': content}) + context = { + 'content': content, + } + return render_mustache('discussion/_content.mustache', context) diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index 47d0a676b4..e587278ff8 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -6,12 +6,15 @@ from xmodule.modulestore.django import modulestore from django.http import HttpResponse from django.utils import simplejson from django.db import connection -import logging from django.conf import settings +from django_comment_client.permissions import check_permissions_by_view +from mitxmako import middleware + +import logging import operator import itertools +import pystache -from django_comment_client.permissions import check_permissions_by_view _FULLMODULES = None _DISCUSSIONINFO = None @@ -175,3 +178,7 @@ def get_annotated_content_infos(course_id, thread, user): _annotate(child) _annotate(thread) return infos + +def render_mustache(template_name, dictionary, *args, **kwargs): + template = middleware.lookup['main'].get_template(template_name).source + return pystache.render(template, dictionary) diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index f6830f0630..9924e540a2 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -338,7 +338,7 @@ initializeFollowThread = (thread) -> "click .admin-endorse": -> handleEndorse(this, not $content.hasClass("endorsed")) - "click .discussion-openclose": -> + "click .admin-openclose": -> handleOpenClose(this, $(this).text()) "click .admin-edit": -> @@ -404,6 +404,6 @@ initializeFollowThread = (thread) -> if not Discussion.getContentInfo id, 'can_delete' $local(".admin-delete").remove() if not Discussion.getContentInfo id, 'can_openclose' - $local(".discussion-openclose").remove() + $local(".admin-openclose").remove() #if not Discussion.getContentInfo id, 'can_vote' # $local(".discussion-vote").css "visibility", "hidden" diff --git a/lms/templates/discussion/_content.html b/lms/templates/discussion/_content.html index 2f37bd89a7..1489f5997c 100644 --- a/lms/templates/discussion/_content.html +++ b/lms/templates/discussion/_content.html @@ -9,7 +9,11 @@