Commit a2f0e31d by Brittany Cheng

Merge branch 'master' of github.com:dementrock/mitx into brittany

parents 9ae21a87 fddee7de
......@@ -121,6 +121,13 @@ def forum_form_discussion(request, course_id, discussion_id):
content = render_forum_discussion(request, course_id, threads, discussion_id=discussion_id, \
query_params=query_params)
recent_active_threads = comment_client.search_recent_active_threads(
course_id,
recursive=False,
query_params={'follower_id': request.user.id,
'commentable_id': discussion_id},
)
if request.is_ajax():
return utils.HtmlResponse(content)
else:
......@@ -129,6 +136,7 @@ def forum_form_discussion(request, course_id, discussion_id):
'course': course,
'content': content,
'accordion': render_accordion(request, course, discussion_id),
'recent_active_threads': recent_active_threads,
}
return render_to_response('discussion/index.html', context)
......
......@@ -34,6 +34,11 @@ def search_similar_threads(course_id, recursive=False, query_params={}, *args, *
attributes = dict(default_params.items() + query_params.items())
return _perform_request('get', _url_for_search_similar_threads(), attributes, *args, **kwargs)
def search_recent_active_threads(course_id, recursive=False, query_params={}, *args, **kwargs):
default_params = {'course_id': course_id, 'recursive': recursive}
attributes = dict(default_params.items() + query_params.items())
return _perform_request('get', _url_for_search_recent_active_threads(), attributes, *args, **kwargs)
def create_user(attributes, *args, **kwargs):
return _perform_request('post', _url_for_users(), attributes, *args, **kwargs)
......@@ -167,6 +172,9 @@ def _url_for_search_threads():
def _url_for_search_similar_threads():
return "{prefix}/search/threads/more_like_this".format(prefix=PREFIX)
def _url_for_search_recent_active_threads():
return "{prefix}/search/threads/recent_active".format(prefix=PREFIX)
def _url_for_threads_tags():
return "{prefix}/threads/tags".format(prefix=PREFIX)
......
......@@ -2,12 +2,8 @@
<div class="recent-activity-title">Recent Activity:</div>
<div class="recent-active-posts">
<a class="recent-active-post" href="javascript:void(0)">Sapiente officiis debitis repellendus eligendi aliquid natus saepe.</a>
<a class="recent-active-post" href="javascript:void(0)">Sapiente officiis debitis repellendus eligendi aliquid natus saepe.</a>
<a class="recent-active-post" href="javascript:void(0)">Sapiente officiis debitis repellendus eligendi aliquid natus saepe.</a>
<a class="recent-active-post" href="javascript:void(0)">Sapiente officiis debitis repellendus eligendi aliquid natus saepe.</a>
<a class="recent-active-post" href="javascript:void(0)">Sapiente officiis debitis repellendus eligendi aliquid natus saepe.</a>
<a class="recent-active-post" href="javascript:void(0)">Sapiente officiis debitis repellendus eligendi aliquid natus saepe.</a>
</div>
<div class="recent-active-posts">
% for thread in recent_active_threads:
<a class="recent-active-post" href="javascript:void(0)">${thread['title']}</a>
% endfor
</div>
......@@ -27,6 +27,7 @@
</nav>
</div>
<%include file="_recent_active_posts.html" />
<%include file="_trending_tags.html" />
</section>
<section class="course-content">
......
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