added in preventDefault calls

pull/567/head
Justin Richer 2014-03-16 20:32:07 -04:00
parent 70b9ac36b1
commit 6f5d689f7f
7 changed files with 107 additions and 70 deletions

View File

@ -83,29 +83,31 @@ var ListWidgetChildView = Backbone.View.extend({
tagName: 'tr',
events:{
"click .btn-delete":function (e) {
e.preventDefault();
//this.$el.tooltip('delete');
this.model.destroy({
error:function (error, response) {
console.log("An error occurred when deleting from a list widget");
"click .btn-delete":'deleteItem'
},
//Pull out the response text.
var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message
$('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static",
"keyboard" : true,
"show" : true // ensure the modal is shown immediately
});
}
});
}
deleteItem:function (e) {
e.preventDefault();
//this.$el.tooltip('delete');
this.model.destroy({
error:function (error, response) {
console.log("An error occurred when deleting from a list widget");
//Pull out the response text.
var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message
$('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static",
"keyboard" : true,
"show" : true // ensure the modal is shown immediately
});
}
});
},
initialize:function () {
@ -284,8 +286,9 @@ var BlackListListView = Backbone.View.extend({
events: {
"click .refresh-table":"refreshTable"
},
refreshTable:function() {
refreshTable:function(e) {
e.preventDefault();
var _self = this;
$('#loadingbox').sheet('show');
$('#loading').html('blacklist');

View File

@ -158,11 +158,13 @@ var ClientView = Backbone.View.extend({
'click .toggleMoreInformation': 'toggleMoreInformation'
},
editClient:function () {
editClient:function (e) {
e.preventDefault();
app.navigate('admin/client/' + this.model.id, {trigger: true});
},
whiteListClient:function() {
whiteListClient:function(e) {
e.preventDefault();
if (this.options.whiteList == null) {
// create a new one
app.navigate('admin/whitelist/new/' + this.model.id, {trigger: true});
@ -172,7 +174,8 @@ var ClientView = Backbone.View.extend({
}
},
deleteClient:function () {
deleteClient:function (e) {
e.preventDefault();
if (confirm("Are you sure sure you would like to delete this client?")) {
var self = this;
@ -209,8 +212,8 @@ var ClientView = Backbone.View.extend({
return false;
},
toggleMoreInformation:function(event) {
event.preventDefault();
toggleMoreInformation:function(e) {
e.preventDefault();
if ($('.moreInformation', this.el).is(':visible')) {
// hide it
$('.moreInformation', this.el).hide('fast');
@ -262,7 +265,8 @@ var ClientListView = Backbone.View.extend({
"click .refresh-table":"refreshTable"
},
newClient:function () {
newClient:function (e) {
e.preventDefault();
this.remove();
app.navigate('admin/client/new', {trigger: true});
},
@ -299,7 +303,8 @@ var ClientListView = Backbone.View.extend({
}
},
refreshTable:function() {
refreshTable:function(e) {
e.preventDefault();
$('#loadingbox').sheet('show');
$('#loading').html('clients');
@ -356,11 +361,13 @@ var ClientFormView = Backbone.View.extend({
"change #logoUri input":"previewLogo"
},
toggleRefreshTokenTimeout:function () {
toggleRefreshTokenTimeout:function (e) {
e.preventDefault();
$("#refreshTokenValidityTime", this.$el).toggle();
},
previewLogo:function(event) {
previewLogo:function(e) {
e.preventDefault();
if ($('#logoUri input', this.el).val()) {
$('#logoPreview', this.el).empty();
$('#logoPreview', this.el).attr('src', $('#logoUri input').val());
@ -373,7 +380,8 @@ var ClientFormView = Backbone.View.extend({
* Set up the form based on the current state of the requireClientSecret checkbox parameter
* @param event
*/
toggleRequireClientSecret:function(event) {
toggleRequireClientSecret:function(e) {
e.preventDefault();
if ($('#requireClientSecret input', this.el).is(':checked')) {
// client secret is required, show all the bits
@ -390,7 +398,8 @@ var ClientFormView = Backbone.View.extend({
* Set up the form based on the "Generate" checkbox
* @param event
*/
toggleGenerateClientSecret:function(event) {
toggleGenerateClientSecret:function(e) {
e.preventDefault();
if ($('#generateClientSecret input', this.el).is(':checked')) {
// show the "generated" block, hide the "display" checkbox
@ -401,7 +410,7 @@ var ClientFormView = Backbone.View.extend({
} else {
// show the display checkbox, fall back to the "display" logic
$('#displayClientSecret', this.el).show();
this.toggleDisplayClientSecret(event);
this.toggleDisplayClientSecret(e);
}
},
@ -409,8 +418,9 @@ var ClientFormView = Backbone.View.extend({
* Handle whether or not to display the client secret
* @param event
*/
toggleDisplayClientSecret:function(event) {
toggleDisplayClientSecret:function(e) {
e.preventDefault();
if ($('#displayClientSecret input').is(':checked')) {
// want to display it
$('#clientSecret', this.el).show();

View File

@ -78,12 +78,14 @@ var DynRegRootView = Backbone.View.extend({
return this;
},
newReg:function() {
newReg:function(e) {
e.preventDefault();
this.remove();
app.navigate('dev/dynreg/new', {trigger: true});
},
editReg:function() {
editReg:function(e) {
e.preventDefault();
var clientId = $('#clientId').val();
var token = $('#regtoken').val();
@ -138,7 +140,8 @@ var DynRegEditView = Backbone.View.extend({
"change #logoUri input":"previewLogo"
},
deleteClient:function () {
deleteClient:function (e) {
e.preventDefault();
if (confirm("Are you sure sure you would like to delete this client?")) {
var self = this;
@ -171,7 +174,8 @@ var DynRegEditView = Backbone.View.extend({
return false;
},
previewLogo:function(event) {
previewLogo:function(e) {
e.preventDefault();
if ($('#logoUri input', this.el).val()) {
$('#logoPreview', this.el).empty();
$('#logoPreview', this.el).attr('src', $('#logoUri input').val());
@ -225,7 +229,8 @@ var DynRegEditView = Backbone.View.extend({
'code-token-idtoken': 'code token id_token'
},
saveClient:function (event) {
saveClient:function (e) {
e.preventDefault();
$('.control-group').removeClass('error');

View File

@ -111,7 +111,8 @@ var ApprovedSiteListView = Backbone.View.extend({
}
},
refreshTable:function() {
refreshTable:function(e) {
e.preventDefault();
var _self = this;
$('#loadingbox').sheet('show');
$('#loading').html('approved sites');
@ -200,7 +201,8 @@ var ApprovedSiteView = Backbone.View.extend({
'click .toggleMoreInformation': 'toggleMoreInformation'
},
deleteApprovedSite:function() {
deleteApprovedSite:function(e) {
e.preventDefault();
if (confirm("Are you sure you want to revoke access to this site?")) {
var self = this;
@ -236,8 +238,8 @@ var ApprovedSiteView = Backbone.View.extend({
return false;
},
toggleMoreInformation:function(event) {
event.preventDefault();
toggleMoreInformation:function(e) {
e.preventDefault();
if ($('.moreInformation', this.el).is(':visible')) {
// hide it
$('.moreInformation', this.el).hide('fast');

View File

@ -76,7 +76,8 @@ var SystemScopeView = Backbone.View.extend({
'click .btn-delete':'deleteScope'
},
editScope:function() {
editScope:function(e) {
e.preventDefault();
app.navigate('admin/scope/' + this.model.id, {trigger: true});
},
@ -88,7 +89,8 @@ var SystemScopeView = Backbone.View.extend({
return this;
},
deleteScope:function () {
deleteScope:function (e) {
e.preventDefault();
if (confirm("Are you sure sure you would like to delete this scope? Clients that have this scope will still be able to ask for it.")) {
var self = this;
@ -154,12 +156,14 @@ var SystemScopeListView = Backbone.View.extend({
"click .refresh-table":"refreshTable"
},
newScope:function() {
newScope:function(e) {
e.preventDefault();
this.remove();
app.navigate('admin/scope/new', {trigger: true});
},
refreshTable:function() {
refreshTable:function(e) {
e.preventDefault();
var _self = this;
$('#loadingbox').sheet('show');
$('#loading').html('approved sites');
@ -250,7 +254,8 @@ var SystemScopeFormView = Backbone.View.extend({
'change #isStructured input':'toggleStructuredParamDescription'
},
toggleStructuredParamDescription:function(event) {
toggleStructuredParamDescription:function(e) {
e.preventDefault();
if ($('#isStructured input', this.el).is(':checked')) {
$('#structuredParamDescription', this.el).show();
} else {
@ -258,7 +263,8 @@ var SystemScopeFormView = Backbone.View.extend({
}
},
saveScope:function(event) {
saveScope:function(e) {
e.preventDefault();
var value = $('#value input').val();
@ -318,7 +324,8 @@ var SystemScopeFormView = Backbone.View.extend({
return false;
},
selectIcon:function(event) {
selectIcon:function(e) {
e.preventDefault();
var icon = event.target.value;

View File

@ -96,7 +96,8 @@ var AccessTokenView = Backbone.View.extend({
return this;
},
deleteToken:function () {
deleteToken:function (e) {
e.preventDefault();
if (confirm("Are you sure sure you would like to revoke this token?")) {
@ -135,8 +136,8 @@ var AccessTokenView = Backbone.View.extend({
return false;
},
toggleMoreInformation:function(event) {
event.preventDefault();
toggleMoreInformation:function(e) {
e.preventDefault();
if ($('.moreInformation', this.el).is(':visible')) {
// hide it
$('.moreInformation', this.el).hide('fast');
@ -154,7 +155,8 @@ var AccessTokenView = Backbone.View.extend({
$(this.el).empty();
},
showTokenValue:function () {
showTokenValue:function (e) {
e.preventDefault();
$('.token-substring', this.el).hide();
$('.token-full', this.el).show();
}
@ -240,7 +242,8 @@ var RefreshTokenView = Backbone.View.extend({
},
deleteToken:function () {
deleteToken:function (e) {
e.preventDefault();
if (confirm("Are you sure sure you would like to revoke this refresh token and its associated access tokens?")) {
@ -279,8 +282,8 @@ var RefreshTokenView = Backbone.View.extend({
return false;
},
toggleMoreInformation:function(event) {
event.preventDefault();
toggleMoreInformation:function(e) {
e.preventDefault();
if ($('.moreInformation', this.el).is(':visible')) {
// hide it
$('.moreInformation', this.el).hide('fast');
@ -298,7 +301,8 @@ var RefreshTokenView = Backbone.View.extend({
$(this.el).empty();
},
showTokenValue:function () {
showTokenValue:function (e) {
e.preventDefault();
$('.token-substring', this.el).hide();
$('.token-full', this.el).show();
}
@ -333,7 +337,8 @@ var TokenListView = Backbone.View.extend({
},
refreshTable:function() {
refreshTable:function(e) {
e.preventDefault();
$('#loadingbox').sheet('show');
$('#loading').html('tokens');
var _self = this;

View File

@ -103,7 +103,8 @@ var WhiteListListView = Backbone.View.extend({
}
},
refreshTable:function() {
refreshTable:function(e) {
e.preventDefault();
var _self = this;
$('#loadingbox').sheet('show');
$('#loading').html('whitelist');
@ -157,11 +158,13 @@ var WhiteListView = Backbone.View.extend({
'click .toggleMoreInformation': 'toggleMoreInformation'
},
editWhitelist:function() {
editWhitelist:function(e) {
e.preventDefault();
app.navigate('admin/whitelist/' + this.model.id, {trigger: true});
},
deleteWhitelist:function() {
deleteWhitelist:function(e) {
e.preventDefault();
if (confirm("Are you sure you want to delete this whitelist entry?")) {
var self = this;
@ -199,8 +202,8 @@ var WhiteListView = Backbone.View.extend({
return false;
},
toggleMoreInformation:function(event) {
event.preventDefault();
toggleMoreInformation:function(e) {
e.preventDefault();
if ($('.moreInformation', this.el).is(':visible')) {
// hide it
$('.moreInformation', this.el).hide('fast');
@ -235,7 +238,8 @@ var WhiteListFormView = Backbone.View.extend({
},
saveWhiteList:function (event) {
saveWhiteList:function (e) {
e.preventDefault();
$('.control-group').removeClass('error');
// process allowed scopes
@ -278,7 +282,8 @@ var WhiteListFormView = Backbone.View.extend({
},
cancelWhiteList:function(event) {
cancelWhiteList:function(e) {
e.preventDefault();
app.navigate('admin/whitelists', {trigger:true});
},