Append swagger-auth global functions to window and don't break backward

This commit is contained in:
Mohsen Azimi
2015-03-16 15:07:14 -07:00
parent 8c6e3a6d95
commit d61cf24ae0
5 changed files with 14 additions and 6 deletions
+2 -2
View File
@@ -202,7 +202,7 @@ function initOAuth(opts) {
});
}
function processOAuthCode(data) {
window.processOAuthCode = function processOAuthCode(data) {
var params = {
'client_id': clientId,
'code': data.code,
@@ -225,7 +225,7 @@ function processOAuthCode(data) {
});
}
function onOAuthComplete(token) {
window.onOAuthComplete = function onOAuthComplete(token) {
if(token) {
if(token.error) {
var checkbox = $('input[type=checkbox],.secured')
+2 -1
View File
@@ -201,7 +201,8 @@ window.SwaggerUi = Backbone.Router.extend({
});
window.SwaggerUi.Views = {};
window.SwaggerUi.Views = {};
this["Handlebars"] = this["Handlebars"] || {};
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+2 -2
View File
@@ -202,7 +202,7 @@ function initOAuth(opts) {
});
}
function processOAuthCode(data) {
window.processOAuthCode = function processOAuthCode(data) {
var params = {
'client_id': clientId,
'code': data.code,
@@ -225,7 +225,7 @@ function processOAuthCode(data) {
});
}
function onOAuthComplete(token) {
window.onOAuthComplete = function onOAuthComplete(token) {
if(token) {
if(token.error) {
var checkbox = $('input[type=checkbox],.secured')
+7
View File
@@ -83,6 +83,13 @@
console.log.apply(console, arguments);
}
}
// don't break backward compatibility with previous versions
window.authorizations = {
add: swaggerUi.api.clientAuthorizations.add
};
window.ApiKeyAuthorization = SwaggerClient.ApiKeyAuthorization;
window.PasswordAuthorization = SwaggerClient.PasswordAuthorization;
});
</script>
</head>
+1 -1
View File
@@ -195,4 +195,4 @@ window.SwaggerUi = Backbone.Router.extend({
});
window.SwaggerUi.Views = {};
window.SwaggerUi.Views = {};