Changeset - d2ce61e4363d
[Not reviewed]
default
0 5 0
Mads Kiilerich - 9 years ago 2016-08-04 14:23:36
madski@unity3d.com
routing: introduce 'notification_delete' url and use POST instead of DELETE
5 files changed with 8 insertions and 7 deletions:
0 comments (0 inline, 0 general)
kallithea/config/routing.py
Show inline comments
 
@@ -379,8 +379,8 @@ def make_map(config):
 
                  action="index", conditions=dict(method=["GET"]))
 
        m.connect("/notifications/{notification_id}",
 
                  action="update", conditions=dict(method=["PUT"]))
 
        m.connect("/notifications/{notification_id}",
 
                  action="delete", conditions=dict(method=["DELETE"]))
 
        m.connect("notification_delete", "/notifications/{notification_id}/delete",
 
                  action="delete", conditions=dict(method=["POST"]))
 
        m.connect("notification", "/notifications/{notification_id}",
 
                  action="show", conditions=dict(method=["GET"]))
 
        m.connect("formatted_notification", "/notifications/{notification_id}.{format}",
kallithea/public/js/base.js
Show inline comments
 
@@ -1000,7 +1000,7 @@ var deleteNotification = function(url, n
 
    var failure = function(o){
 
            alert("deleteNotification failure");
 
        };
 
    var postData = {'_method': 'delete'};
 
    var postData = {};
 
    var sUrl = url.replace('__NOTIFICATION_ID__',notification_id);
 
    ajaxPOST(sUrl, postData, success, failure);
 
};
kallithea/templates/admin/notifications/notifications.html
Show inline comments
 
@@ -35,11 +35,12 @@
 
  </div>
 
</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 run = function(){
 
  $('.delete-notification').click(function(e){
 
    var notification_id = e.currentTarget.id;
 
    deleteNotification(url_action,notification_id);
 
    deleteNotification(url_delete,notification_id);
 
  });
 
  $('.read-notification').click(function(e){
 
    var notification_id = e.currentTarget.id;
kallithea/templates/admin/notifications/show_notification.html
Show inline comments
 
@@ -42,7 +42,7 @@
 
    </div>
 
</div>
 
<script type="text/javascript">
 
var url = "${url('notification', notification_id='__NOTIFICATION_ID__')}";
 
var url = "${url('notification_delete', notification_id='__NOTIFICATION_ID__')}";
 
var main = "${url('notifications')}";
 
   $('.delete-notification').click(function(e){
 
       var notification_id = e.currentTarget.id;
kallithea/tests/functional/test_admin_notifications.py
Show inline comments
 
@@ -61,8 +61,8 @@ class TestNotificationsController(TestCo
 
        cur_usr_id = cur_user.user_id
 

	
 
        response = self.app.post(
 
            url('notification', notification_id=notification.notification_id),
 
            params={'_method': 'delete', '_authentication_token': self.authentication_token()})
 
            url('notification_delete', notification_id=notification.notification_id),
 
            params={'_authentication_token': self.authentication_token()})
 
        assert response.body == 'ok'
 

	
 
        cur_user = User.get(cur_usr_id)
0 comments (0 inline, 0 general)