From e22371b80d97342f6d488a3b48db7d6d3a81c838 Mon Sep 17 00:00:00 2001 From: Rocky Duan Date: Sat, 4 Aug 2012 19:41:24 -0400 Subject: [PATCH] fixed some notification stuff --- lms/templates/notifications.html | 53 +++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/lms/templates/notifications.html b/lms/templates/notifications.html index a6296f3029..986a09500b 100644 --- a/lms/templates/notifications.html +++ b/lms/templates/notifications.html @@ -20,6 +20,11 @@ def discussion_title(discussion_id): return get_discussion_title(discussion_id=discussion_id) %> +<% +def url_for_user(user_id): #TODO + return "javascript:void(0)" +%> +
% for notification in notifications: @@ -27,21 +32,47 @@ def discussion_title(discussion_id): % endfor
+<%def name="render_user_link(notification)"> + <% info = notification['info'] %> + % if notification.get('actor_id', None): + ${info['actor_username']} + % else: + Anonymous + % endif + + +<%def name="render_thread_link(notification)"> + <% info = notification['info'] %> + ${info['thread_title']} + + +<%def name="render_comment_link(notification)"> + <% info = notification['info'] %> + comment + + +<%def name="render_discussion_link(notification)"> + <% info = notification['info'] %> + ${discussion_title(info['commentable_id'])} + + <%def name="render_notification(notification)">
- <% info = notification['info'] %> % if notification['notification_type'] == 'post_reply': - User No.${notification['actor_id']} posted a - comment - to the thread - ${info['thread_title']} - in discussion - ${discussion_title(info['commentable_id'])} + ${render_user_link(notification)} posted a ${render_comment_link(notification)} + to the thread ${render_thread_link(notification)} in discussion ${render_discussion_link(notification)} % elif notification['notification_type'] == 'post_topic': - User No.${notification['actor_id']} posted a new thread - ${info['thread_title']} - in discussion - ${discussion_title(info['commentable_id'])} + ${render_user_link(notification)} posted a new thread ${render_thread_link(notification)} + in discussion ${render_discussion_link(notification)} + % elif notification['notification_type'] == 'at_user': + ${render_user(info)} mentioned you in + % if notification['info']['content_type'] == 'thread': + the thread ${render_thread_link(notification)} + in discussion ${render_discussion_link(notification)} + % else: + ${render_comment_link(notification)} + to the thread ${render_thread_link(notification)} in discussion ${render_discussion_link(notification)} + % endif % endif