diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index b7dd9cff79..9b55addd4b 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -128,6 +128,11 @@ def forum_form_discussion(request, course_id, discussion_id): 'commentable_id': discussion_id}, ) + trending_tags = comment_client.search_trending_tags( + course_id, + query_params={'commentable_id': discussion_id}, + ) + if request.is_ajax(): return utils.HtmlResponse(content) else: @@ -137,6 +142,7 @@ def forum_form_discussion(request, course_id, discussion_id): 'content': content, 'accordion': render_accordion(request, course, discussion_id), 'recent_active_threads': recent_active_threads, + 'trending_tags': trending_tags, } return render_to_response('discussion/index.html', context) diff --git a/lms/lib/comment_client.py b/lms/lib/comment_client.py index 7e53042ea0..d3a03ab3c2 100644 --- a/lms/lib/comment_client.py +++ b/lms/lib/comment_client.py @@ -39,6 +39,11 @@ def search_recent_active_threads(course_id, recursive=False, query_params={}, *a attributes = dict(default_params.items() + query_params.items()) return _perform_request('get', _url_for_search_recent_active_threads(), attributes, *args, **kwargs) +def search_trending_tags(course_id, query_params={}, *args, **kwargs): + default_params = {'course_id': course_id} + attributes = dict(default_params.items() + query_params.items()) + return _perform_request('get', _url_for_search_trending_tags(), attributes, *args, **kwargs) + def create_user(attributes, *args, **kwargs): return _perform_request('post', _url_for_users(), attributes, *args, **kwargs) @@ -175,6 +180,9 @@ def _url_for_search_similar_threads(): def _url_for_search_recent_active_threads(): return "{prefix}/search/threads/recent_active".format(prefix=PREFIX) +def _url_for_search_trending_tags(): + return "{prefix}/search/tags/trending".format(prefix=PREFIX) + def _url_for_threads_tags(): return "{prefix}/threads/tags".format(prefix=PREFIX) diff --git a/lms/templates/discussion/_trending_tags.html b/lms/templates/discussion/_trending_tags.html index 292c716cd9..d4400bc5d7 100644 --- a/lms/templates/discussion/_trending_tags.html +++ b/lms/templates/discussion/_trending_tags.html @@ -1,11 +1,11 @@ Trending tags: