[auth] Added logout button

This commit is contained in:
Anna Bodnia
2016-02-24 18:42:28 +02:00
parent 0644f7611a
commit a50536693c
10 changed files with 122 additions and 34 deletions

View File

@@ -84,11 +84,16 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
render: function () {
// Render the outer container for resources
var authsModel;
$(this.el).html(Handlebars.templates.main(this.model));
this.model.securityDefinitions = this.model.securityDefinitions || {};
if (this.model.securityDefinitions) {
this.authView = new SwaggerUi.Views.AuthView({model: this.model.securityDefinitions, router: this.router});
if (!_.isEmpty(this.model.securityDefinitions)) {
authsModel = { auths: this.model.securityDefinitions };
authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz);
this.authView = new SwaggerUi.Views.AuthView({model: authsModel, router: this.router});
this.$('.authorize-wrapper').append(this.authView.render().el);
}