##// END OF EJS Templates
routing: introduce 'notification_delete' url and use POST instead of DELETE
Mads Kiilerich -
r6039:d2ce61e4 default
parent child Browse files
Show More
@@ -379,8 +379,8 b' def make_map(config):'
379 379 action="index", conditions=dict(method=["GET"]))
380 380 m.connect("/notifications/{notification_id}",
381 381 action="update", conditions=dict(method=["PUT"]))
382 m.connect("/notifications/{notification_id}",
383 action="delete", conditions=dict(method=["DELETE"]))
382 m.connect("notification_delete", "/notifications/{notification_id}/delete",
383 action="delete", conditions=dict(method=["POST"]))
384 384 m.connect("notification", "/notifications/{notification_id}",
385 385 action="show", conditions=dict(method=["GET"]))
386 386 m.connect("formatted_notification", "/notifications/{notification_id}.{format}",
@@ -1000,7 +1000,7 b' var deleteNotification = function(url, n'
1000 1000 var failure = function(o){
1001 1001 alert("deleteNotification failure");
1002 1002 };
1003 var postData = {'_method': 'delete'};
1003 var postData = {};
1004 1004 var sUrl = url.replace('__NOTIFICATION_ID__',notification_id);
1005 1005 ajaxPOST(sUrl, postData, success, failure);
1006 1006 };
@@ -35,11 +35,12 b''
35 35 </div>
36 36 </div>
37 37 <script type="text/javascript">
38 var url_delete = "${url('notification_delete', notification_id='__NOTIFICATION_ID__')}";
38 39 var url_action = "${url('notification', notification_id='__NOTIFICATION_ID__')}";
39 40 var run = function(){
40 41 $('.delete-notification').click(function(e){
41 42 var notification_id = e.currentTarget.id;
42 deleteNotification(url_action,notification_id);
43 deleteNotification(url_delete,notification_id);
43 44 });
44 45 $('.read-notification').click(function(e){
45 46 var notification_id = e.currentTarget.id;
@@ -42,7 +42,7 b''
42 42 </div>
43 43 </div>
44 44 <script type="text/javascript">
45 var url = "${url('notification', notification_id='__NOTIFICATION_ID__')}";
45 var url = "${url('notification_delete', notification_id='__NOTIFICATION_ID__')}";
46 46 var main = "${url('notifications')}";
47 47 $('.delete-notification').click(function(e){
48 48 var notification_id = e.currentTarget.id;
@@ -61,8 +61,8 b' class TestNotificationsController(TestCo'
61 61 cur_usr_id = cur_user.user_id
62 62
63 63 response = self.app.post(
64 url('notification', notification_id=notification.notification_id),
65 params={'_method': 'delete', '_authentication_token': self.authentication_token()})
64 url('notification_delete', notification_id=notification.notification_id),
65 params={'_authentication_token': self.authentication_token()})
66 66 assert response.body == 'ok'
67 67
68 68 cur_user = User.get(cur_usr_id)
General Comments 0
You need to be logged in to leave comments. Login now