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