changeset 6077:949d50b31c22

routing: introduce 'notification_update' url and use POST instead of PUT
author Mads Kiilerich <madski@unity3d.com>
date Thu, 04 Aug 2016 14:23:36 +0200
parents d2ce61e4363d
children 84c3d3776ab7
files kallithea/config/routing.py kallithea/public/js/base.js kallithea/templates/admin/notifications/notifications.html
diffstat 3 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/routing.py	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/config/routing.py	Thu Aug 04 14:23:36 2016 +0200
@@ -377,8 +377,8 @@
                   action="mark_all_read", conditions=dict(method=["GET"]))
         m.connect("formatted_notifications", "/notifications.{format}",
                   action="index", conditions=dict(method=["GET"]))
-        m.connect("/notifications/{notification_id}",
-                  action="update", conditions=dict(method=["PUT"]))
+        m.connect("notification_update", "/notifications/{notification_id}/update",
+                  action="update", conditions=dict(method=["POST"]))
         m.connect("notification_delete", "/notifications/{notification_id}/delete",
                   action="delete", conditions=dict(method=["POST"]))
         m.connect("notification", "/notifications/{notification_id}",
--- a/kallithea/public/js/base.js	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/public/js/base.js	Thu Aug 04 14:23:36 2016 +0200
@@ -1015,7 +1015,7 @@
     var failure = function(o){
             alert("readNotification failure");
         };
-    var postData = {'_method': 'put'};
+    var postData = {};
     var sUrl = url.replace('__NOTIFICATION_ID__',notification_id);
     ajaxPOST(sUrl, postData, success, failure);
 };
--- a/kallithea/templates/admin/notifications/notifications.html	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/templates/admin/notifications/notifications.html	Thu Aug 04 14:23:36 2016 +0200
@@ -36,7 +36,7 @@
 </div>
 <script type="text/javascript">
 var url_delete = "${url('notification_delete', notification_id='__NOTIFICATION_ID__')}";
-var url_action = "${url('notification', notification_id='__NOTIFICATION_ID__')}";
+var url_read = "${url('notification_update', notification_id='__NOTIFICATION_ID__')}";
 var run = function(){
   $('.delete-notification').click(function(e){
     var notification_id = e.currentTarget.id;
@@ -44,7 +44,7 @@
   });
   $('.read-notification').click(function(e){
     var notification_id = e.currentTarget.id;
-    readNotification(url_action,notification_id);
+    readNotification(url_read,notification_id);
   });
 }
 run();