[auth] UI changes

This commit is contained in:
bodnia
2016-03-11 19:02:56 +02:00
parent e08b7be581
commit 1e38c8999b
20 changed files with 1583 additions and 7493 deletions

View File

@@ -7,18 +7,22 @@ SwaggerUi.Views.AuthButtonView = Backbone.View.extend({
tpls: {
popup: Handlebars.templates.popup,
authBtn: Handlebars.templates.auth_button
authBtn: Handlebars.templates.auth_button,
authBtnOperation: Handlebars.templates.auth_button_operation
},
initialize: function(opts) {
this.options = opts || {};
this.options.data = this.options.data || {};
this.isOperation = this.options.isOperation;
this.router = this.options.router;
this.auths = this.options.data.oauth2.concat(this.options.data.auths);
},
render: function () {
this.$el.html(this.tpls.authBtn(this.model));
var tplName = this.isOperation ? 'authBtnOperation' : 'authBtn';
this.$el.html(this.tpls[tplName](this.model));
return this;
},

View File

@@ -13,7 +13,7 @@
SwaggerUi.Views.AuthView = Backbone.View.extend({
events: {
'click .auth_submit_button': 'authorizeClick',
'click .auth_submit__button': 'authorizeClick',
'click .auth_logout__button': 'logoutClick'
},

View File

@@ -261,7 +261,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security);
authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz);
this.authView = new SwaggerUi.Views.AuthButtonView({data: authsModel, router: this.router});
this.authView = new SwaggerUi.Views.AuthButtonView({data: authsModel, router: this.router, isOperation: true});
this.$('.authorize-wrapper').append(this.authView.render().el);
}