From b2b4fac254be26a1a79c14b97f75162e56b45e12 Mon Sep 17 00:00:00 2001 From: "theodore.therone@gmail.com" Date: Wed, 11 Nov 2015 11:04:12 +0000 Subject: [PATCH 1/4] fix attempt to fix my mess --- notifications/static/notifications/notify.js | 2 +- .../templates/notifications/test_tags.html | 2 +- .../templatetags/notifications_tags.py | 4 ++-- notifications/views.py | 19 +++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/notifications/static/notifications/notify.js b/notifications/static/notifications/notify.js index 6ec2796..546261a 100644 --- a/notifications/static/notifications/notify.js +++ b/notifications/static/notifications/notify.js @@ -20,7 +20,7 @@ function fill_notification_list(data) { menu.innerHTML = ""; for (var i=0; i < data.unread_list.length; i++) { var item = data.unread_list[i]; - menu.innerHTML = menu.innerHTML + "
  • "+item.object+" "+item.verb+" "+item.subject+"
  • "; + menu.innerHTML = menu.innerHTML + "
  • "+item.actor+" "+item.verb+" "+item.target+"
  • "; } } } diff --git a/notifications/templates/notifications/test_tags.html b/notifications/templates/notifications/test_tags.html index 6ace50b..eab7bda 100644 --- a/notifications/templates/notifications/test_tags.html +++ b/notifications/templates/notifications/test_tags.html @@ -1,6 +1,6 @@ {% load notifications_tags %} -{% register_notify_callbacks callbacks='fill_aristotle_notification_menu,fill_notification_badge' %} +{% register_notify_callbacks callbacks='fill_notification_menu,fill_notification_badge' %} {% notifications_unread as unread %} {{ unread }} diff --git a/notifications/templatetags/notifications_tags.py b/notifications/templatetags/notifications_tags.py index 4cbc6f5..3263a19 100644 --- a/notifications/templatetags/notifications_tags.py +++ b/notifications/templatetags/notifications_tags.py @@ -32,7 +32,7 @@ def register_notify_callbacks(badge_id='live_notify_badge',menu_id='live_notify_ notify_unread_url='{unread_url}'; notify_mark_all_unread_url='{mark_all_unread_url}'; notify_refresh_period={refresh};""".format(badge_id=badge_id,menu_id=menu_id,refresh=refresh_period,api_url=api_url,unread_url=reverse('notifications:unread'),mark_all_unread_url=reverse('notifications:mark_all_as_read')) - + script = " {% register_notify_callbacks callbacks='fill_notification_list,fill_notification_badge' %} ``register_notify_callbacks`` takes the following arguments: - 1. ``badge_id`` (default ``live_notify_badge``) - The `id` attribute of the element to show the unread count, that will be periodically updated. - #. ``menu_id`` (default ``live_notify_list``) - The `id` attribute of the element to insert a list of unread items, that will be periodically updated. - #. ``refresh_period`` (default ``15``) - How often to fetch unread items from the server (integer in seconds). - #. ``callbacks`` (default ````) - A comma-separated list of javascript functions to call each period. - #. ``api_url_name`` (default ``list``) - The name of the API to call (this can be either ``list`` or ``count``). + 1. ``badge_id`` (default ``live_notify_badge``) - The `id` attribute of the element to show the unread count, that will be periodically updated. + #. ``menu_id`` (default ``live_notify_list``) - The `id` attribute of the element to insert a list of unread items, that will be periodically updated. + #. ``refresh_period`` (default ``15``) - How often to fetch unread items from the server (integer in seconds). + #. ``callbacks`` (default ````) - A comma-separated list of javascript functions to call each period. + #. ``api_url_name`` (default ``list``) - The name of the API to call (this can be either ``list`` or ``count``). - 3. To insert a live-updating unread count, use the following template:: + 3. To insert a live-updating unread count, use the following template:: {% live_notify_badge %} ``live_notify_badge`` takes the following arguments: - 1. ``badge_id`` (default ``live_notify_badge``) - The ``id`` attribute for the ```` element that will be created to show the unread count. - #. ``classes`` (default ````) - A string used to populate the ``class`` attribute of the above element. + 1. ``badge_id`` (default ``live_notify_badge``) - The ``id`` attribute for the ```` element that will be created to show the unread count. + #. ``classes`` (default ````) - A string used to populate the ``class`` attribute of the above element. - 4. To insert a live-updating unread count, use the following template:: + 4. To insert a live-updating unread count, use the following template:: {% live_notify_list %} - + ``live_notify_list`` takes the following arguments: - 1. ``list_id`` (default ``live_notify_list``) - The ``id`` attribute for the ``
      `` element that will be created to insert the list of notifications into. - #. ``classes`` (default ````) - A string used to populate the ``class`` attribute of the above element. + 1. ``list_id`` (default ``live_notify_list``) - The ``id`` attribute for the ``
        `` element that will be created to insert the list of notifications into. + #. ``classes`` (default ````) - A string used to populate the ``class`` attribute of the above element. Using the live-updater with bootstrap ------------------------------------- @@ -319,7 +319,7 @@ While the live notifier for unread counts should suit most use cases, users may unread notifications are shown. The ``callbacks`` argument of the ``register_notify_callbacks`` dictates which javascript functions are called when -the unread api call is made. +the unread api call is made. To add a custom javascript callback, simply add this to the list, like so:: diff --git a/notifications/__init__.py b/notifications/__init__.py index 03628d4..96bd755 100644 --- a/notifications/__init__.py +++ b/notifications/__init__.py @@ -11,7 +11,7 @@ except ImportError: __version_info__ = { 'major': 0, - 'minor': 7, + 'minor': 8, 'micro': 0, 'releaselevel': 'final', 'serial': 0