[auth] fixed display of scopes in auth button, added highlight of empty field
This commit is contained in:
@@ -6,6 +6,10 @@ SwaggerUi.Views.ApiKeyAuthView = Backbone.View.extend({ // TODO: append this to
|
||||
'change .input_apiKey_entry': 'apiKeyChange'
|
||||
},
|
||||
|
||||
selectors: {
|
||||
apikeyInput: '.input_apiKey_entry'
|
||||
},
|
||||
|
||||
template: Handlebars.templates.apikey_auth,
|
||||
|
||||
initialize: function(opts) {
|
||||
@@ -21,12 +25,21 @@ SwaggerUi.Views.ApiKeyAuthView = Backbone.View.extend({ // TODO: append this to
|
||||
|
||||
apiKeyChange: function (e) {
|
||||
var val = $(e.target).val();
|
||||
if (val) {
|
||||
this.$(this.selectors.apikeyInput).removeClass('error');
|
||||
}
|
||||
|
||||
this.model.set('value', val);
|
||||
},
|
||||
|
||||
isValid: function () {
|
||||
return this.model.validate();
|
||||
},
|
||||
|
||||
highlightInvalid: function () {
|
||||
if (!this.isValid()) {
|
||||
this.$(this.selectors.apikeyInput).addClass('error');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user