Commit 62769971 by Your Name

update checkbox with get settings

parent d95693eb
......@@ -80,9 +80,6 @@ class @DiscussionUtil
permanent_link_thread : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}"
permanent_link_comment : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}##{param2}"
user_profile : "/courses/#{$$course_id}/discussion/forum/users/#{param}"
user_stats : "/courses/#{$$course_id}/discussion/panel/stats"
followed_threads : "/courses/#{$$course_id}/discussion/forum/users/#{param}/followed"
threads : "/courses/#{$$course_id}/discussion/forum"
}[name]
......
......@@ -197,7 +197,7 @@ if Backbone?
@template = _.template($("#discussion-home").html())
$(".discussion-column").html(@template)
$(".post-list a").removeClass("active")
@retrieveUserStats()
$(".email-notification").bind "click", @updateEmailNotifications
thread_id = null
toggleTopicDrop: (event) =>
......@@ -321,15 +321,6 @@ if Backbone?
if callback?
callback()
retrieveUserStats: () ->
url = DiscussionUtil.urlFor("user_stats")
DiscussionUtil.safeAjax
url: url
type: "GET"
success: (response, textStatus) =>
alert('success')
error: (response) =>
alert('error')
retrieveDiscussions: (discussion_ids) ->
@discussionIds = discussion_ids.join(',')
......@@ -437,3 +428,9 @@ if Backbone?
retrieveFollowed: (event)=>
@mode = 'followed'
@retrieveFirstPage(event)
updateEmailNotifications: () =>
if $('input.email-notification').attr('checked')
alert('checked')
else
alert('unchecked')
\ No newline at end of file
......@@ -3,7 +3,6 @@ from django.conf.urls.defaults import url, patterns
urlpatterns = patterns('django_comment_client.base.views', # nopep8
url(r'upload$', 'upload', name='upload'),
url(r'users/(?P<user_id>\w+)/update_moderator_status$', 'update_moderator_status', name='update_moderator_status'),
url(r'panel/stats', 'user_stats', name='user_stats'),
url(r'threads/tags/autocomplete$', 'tags_autocomplete', name='tags_autocomplete'),
url(r'threads/(?P<thread_id>[\w\-]+)/update$', 'update_thread', name='update_thread'),
url(r'threads/(?P<thread_id>[\w\-]+)/reply$', 'create_comment', name='create_comment'),
......
......@@ -649,20 +649,3 @@ def upload(request, course_id): # ajax upload file to a question or answer
'file_url': file_url,
}
})
@login_required
def user_stats(request, course_id):
try:
profiled_user = cc.User(id=request.user.id, course_id=course_id)
print "\n\n\n*******************\n\n\n"
print profiled_user.course_id
query_params = {}
user_stats_results = profiled_user.stats(query_params)
return utils.JsonResponse({
'stats': user_stats_results
})
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError, User.DoesNotExist):
raise Http404
......@@ -75,15 +75,6 @@ class User(models.Model):
response = perform_request('get', url, params)
return response.get('collection', []), response.get('page', 1), response.get('num_pages', 1)
def stats(self, query_params={}):
if not self.course_id:
raise CommentClientError("Must provide course_id when retrieving stats for the user")
url = _url_for_user_stats(self.id,self.course_id)
params = {'course_id': self.course_id}
params = merge_dict(params, query_params)
response = perform_request('get', url, params)
return response.get('collection', []), response.get('page', 1), response.get('num_pages', 1)
def _retrieve(self, *args, **kwargs):
url = self.url(action='get', params=self.attributes)
retrieve_params = self.default_retrieve_params
......
......@@ -177,26 +177,6 @@
<span class="label">DISCUSSION HOME:</span>
<h1 class="home-title">${course.display_name_with_default}</h1>
</section>
<section class="home-stats">
<div class="label-area">
<span class="label"> PROFILE, PARTICIPATION</span>
<a href="#" class="profile-link">Your profile Name</a>
</div>
<div class="stats-grouping">
<div class="profile-stat profile-stat-posts">
<span class="count count-posts">5</span>
<span class="profile-stat-label">POSTS</span>
</div>
<div class="profile-stat profile-stat-comments">
<span class="count count-comments">12</span>
<span class="profile-stat-label">COMMENTS</span>
</div>
<div class="profile-stat profile-stat-following">
<span class="count count-following">9</span>
<span class="profile-stat-label">FOLLOWING</span>
</div>
</div>
</section>
<span class="label label-settings">HOW TO USE EDX DISCUSSIONS</span>
<table class="home-helpgrid">
<tr class="helpgrid-row helpgrid-row-navigation">
......@@ -233,7 +213,7 @@
<td class="row-title">Receive updates</td>
<td class="row-item-full" colspan="3">
<i class="icon icon-envelope"></i>
<span class="row-setting"><input type="checkbox" name="email-notification"></input></span>
<span class="row-setting"><input type="checkbox" class = "email-notification" name="email-notification"></input></span>
<span class="row-description"> If enabled, you will receive an email digest once a day notifying you about new, unread activity from posts you are following. </span>
</td>
</tr>
......
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