[auth] Added display of oauth2
This commit is contained in:
@@ -14,7 +14,7 @@ SwaggerUi.Views.AuthButtonView = Backbone.View.extend({
|
||||
this.options = opts || {};
|
||||
this.options.data = this.options.data || {};
|
||||
this.router = this.options.router;
|
||||
this.auths = this.options.data.auths;
|
||||
this.auths = this.options.data.oauth2.concat(this.options.data.auths);
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
||||
@@ -72,14 +72,16 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
|
||||
var authEl;
|
||||
var type = authModel.get('type');
|
||||
|
||||
//todo refactor move view name into var and call new with it.
|
||||
if (type === 'apiKey') {
|
||||
authEl = new SwaggerUi.Views.ApiKeyAuthView({model: authModel, router: this.router}).render().el;
|
||||
this.$innerEl.append(authEl);
|
||||
} else if (type === 'basic' && this.$innerEl.find('.basic_auth_container').length === 0) {
|
||||
authEl = new SwaggerUi.Views.BasicAuthView({model: authModel, router: this.router}).render().el;
|
||||
this.$innerEl.append(authEl);
|
||||
} else if (type === 'oauth2') {
|
||||
authEl = new SwaggerUi.Views.Oauth2View({model: authModel, router: this.router}).render().el;
|
||||
}
|
||||
|
||||
this.$innerEl.append(authEl);
|
||||
},
|
||||
|
||||
isValidCollection: function () {
|
||||
|
||||
19
src/main/javascript/view/Oauth2View.js
Normal file
19
src/main/javascript/view/Oauth2View.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
SwaggerUi.Views.Oauth2View = Backbone.View.extend({
|
||||
events: {
|
||||
'change .oauth-scope': 'scopeChange'
|
||||
},
|
||||
|
||||
template: Handlebars.templates.oauth2,
|
||||
|
||||
render: function () {
|
||||
$(this.el).html(this.template(this.model.toJSON()));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
scopeChange: function () {
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user