Commit 8915c1d0 by Ibrahim Awwal

Change following=>followed.

parent 46e12058
...@@ -2,7 +2,7 @@ from django.conf.urls.defaults import url, patterns ...@@ -2,7 +2,7 @@ from django.conf.urls.defaults import url, patterns
import django_comment_client.forum.views import django_comment_client.forum.views
urlpatterns = patterns('django_comment_client.forum.views', urlpatterns = patterns('django_comment_client.forum.views',
url(r'users/(?P<user_id>\w+)/following$', 'following_threads', name='following_threads'), url(r'users/(?P<user_id>\w+)/followed$', 'followed_threads', name='followed_threads'),
url(r'users/(?P<user_id>\w+)$', 'user_profile', name='user_profile'), url(r'users/(?P<user_id>\w+)$', 'user_profile', name='user_profile'),
url(r'(?P<discussion_id>[\w\-]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'), url(r'(?P<discussion_id>[\w\-]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'),
url(r'(?P<discussion_id>[\w\-]+)/inline$', 'inline_discussion', name='inline_discussion'), url(r'(?P<discussion_id>[\w\-]+)/inline$', 'inline_discussion', name='inline_discussion'),
......
...@@ -279,7 +279,7 @@ def user_profile(request, course_id, user_id): ...@@ -279,7 +279,7 @@ def user_profile(request, course_id, user_id):
raise Http404 raise Http404
def following_threads(request, course_id, user_id): def followed_threads(request, course_id, user_id):
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load')
try: try:
profiled_user = cc.User(id=user_id, course_id=course_id) profiled_user = cc.User(id=user_id, course_id=course_id)
......
...@@ -26,7 +26,6 @@ if Backbone? ...@@ -26,7 +26,6 @@ if Backbone?
model model
retrieveAnotherPage: (mode, options={}, sort_options={})-> retrieveAnotherPage: (mode, options={}, sort_options={})->
# TODO: I really feel that this belongs in DiscussionThreadListView
@current_page += 1 @current_page += 1
data = { page: @current_page } data = { page: @current_page }
switch mode switch mode
...@@ -37,8 +36,8 @@ if Backbone? ...@@ -37,8 +36,8 @@ if Backbone?
data['commentable_ids'] = options.commentable_ids data['commentable_ids'] = options.commentable_ids
when 'all' when 'all'
url = DiscussionUtil.urlFor 'threads' url = DiscussionUtil.urlFor 'threads'
when 'following' when 'followed'
url = DiscussionUtil.urlFor 'following_threads', options.user_id url = DiscussionUtil.urlFor 'followed_threads', options.user_id
data['sort_key'] = sort_options.sort_key || 'date' data['sort_key'] = sort_options.sort_key || 'date'
data['sort_order'] = sort_options.sort_order || 'desc' data['sort_order'] = sort_options.sort_order || 'desc'
DiscussionUtil.safeAjax DiscussionUtil.safeAjax
......
...@@ -66,7 +66,7 @@ class @DiscussionUtil ...@@ -66,7 +66,7 @@ class @DiscussionUtil
permanent_link_thread : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}" permanent_link_thread : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}"
permanent_link_comment : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}##{param2}" permanent_link_comment : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}##{param2}"
user_profile : "/courses/#{$$course_id}/discussion/forum/users/#{param}" user_profile : "/courses/#{$$course_id}/discussion/forum/users/#{param}"
following_threads : "/courses/#{$$course_id}/discussion/forum/users/#{param}/following" followed_threads : "/courses/#{$$course_id}/discussion/forum/users/#{param}/followed"
threads : "/courses/#{$$course_id}/discussion/forum" threads : "/courses/#{$$course_id}/discussion/forum"
}[name] }[name]
......
...@@ -128,7 +128,7 @@ if Backbone? ...@@ -128,7 +128,7 @@ if Backbone?
when 'search' when 'search'
options.search_text = @current_search options.search_text = @current_search
options.commentable_ids = @discussionIds options.commentable_ids = @discussionIds
when 'following' when 'followed'
options.user_id = window.user.id options.user_id = window.user.id
@collection.retrieveAnotherPage(@mode, options, {sort_key: @sortBy}) @collection.retrieveAnotherPage(@mode, options, {sort_key: @sortBy})
...@@ -257,7 +257,7 @@ if Backbone? ...@@ -257,7 +257,7 @@ if Backbone?
@$(".post-search-field").val("") @$(".post-search-field").val("")
@retrieveAllThreads() @retrieveAllThreads()
else if discussionId == "#following" else if discussionId == "#following"
@retrieveFollowing(event) @retrieveFollowed(event)
# Retrieve following # Retrieve following
else else
discussionIds = _.map item.find(".board-name[data-discussion_id]"), (board) -> $(board).data("discussion_id").id discussionIds = _.map item.find(".board-name[data-discussion_id]"), (board) -> $(board).data("discussion_id").id
...@@ -388,8 +388,8 @@ if Backbone? ...@@ -388,8 +388,8 @@ if Backbone?
scrollTarget = Math.max(scrollTop - itemFromTop - $(".browse-topic-drop-menu").height() + $(items[index]).height(), scrollTarget) scrollTarget = Math.max(scrollTop - itemFromTop - $(".browse-topic-drop-menu").height() + $(items[index]).height(), scrollTarget)
$(".browse-topic-drop-menu").scrollTop(scrollTarget) $(".browse-topic-drop-menu").scrollTop(scrollTarget)
retrieveFollowing: (event)=> retrieveFollowed: (event)=>
@mode = 'following' @mode = 'followed'
@collection.reset() @collection.reset()
@collection.current_page = 0 @collection.current_page = 0
@loadMorePages(event) @loadMorePages(event)
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