Ensure delete/drop works without JS errors.

This commit is contained in:
Khushboo Vashi 2016-05-06 15:47:21 +01:00 committed by Dave Page
parent f3d05279a7
commit e522ebbcca

View File

@ -89,7 +89,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
applies: ['object', 'context'], callback: 'delete_obj', applies: ['object', 'context'], callback: 'delete_obj',
priority: 3, label: '{{ _("Delete/Drop") }}', priority: 3, label: '{{ _("Delete/Drop") }}',
data: {'url': 'drop'}, icon: 'fa fa-trash', data: {'url': 'drop'}, icon: 'fa fa-trash',
enable: _.isFunction(self.canDrop) ? function() { return self.canDrop.apply(self, arguments); } : false enable: _.isFunction(self.canDrop) ? !!self.canDrop.apply(self, arguments) : (!!self.canDrop)
}]); }]);
if (self.canDropCascade) { if (self.canDropCascade) {
pgAdmin.Browser.add_menus([{ pgAdmin.Browser.add_menus([{
@ -97,8 +97,8 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
applies: ['object', 'context'], callback: 'delete_obj', applies: ['object', 'context'], callback: 'delete_obj',
priority: 3, label: '{{ _("Drop Cascade") }}', priority: 3, label: '{{ _("Drop Cascade") }}',
data: {'url': 'delete'}, icon: 'fa fa-trash', data: {'url': 'delete'}, icon: 'fa fa-trash',
enable: (_.isFunction(self.canDropCascade) ? enable: _.isFunction(self.canDropCascade) ?
function() { return self.canDropCascade.apply(self, arguments); } : true) function() { return self.canDropCascade.apply(self, arguments); } : (!!self.canDropCascade)
}]); }]);
} }
} }