diff --git a/src/main/javascript/helpers/handlebars.js b/src/main/javascript/helpers/handlebars.js index 226acc30bef..e596e4c3398 100644 --- a/src/main/javascript/helpers/handlebars.js +++ b/src/main/javascript/helpers/handlebars.js @@ -7,7 +7,7 @@ Handlebars.registerHelper('sanitize', function(html) { }); Handlebars.registerHelper('renderTextParam', function(param) { - var result, type = 'text'; + var result, type = 'text', idAtt = ''; var isArray = param.type.toLowerCase() === 'array' || param.allowMultiple; var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default; @@ -16,11 +16,15 @@ Handlebars.registerHelper('renderTextParam', function(param) { } if(param.format && param.format === 'password') { - type = 'password'; + type = 'password'; + } + + if(param.valueId) { + idAtt = ' id=\'' + param.valueId + '\''; } if(isArray) { - result = ''; } else { @@ -29,7 +33,7 @@ Handlebars.registerHelper('renderTextParam', function(param) { parameterClass += ' required'; } result = ''; } return new Handlebars.SafeString(result); diff --git a/src/main/javascript/view/ContentTypeView.js b/src/main/javascript/view/ContentTypeView.js index 5a9b49cb325..bad7ca7b437 100644 --- a/src/main/javascript/view/ContentTypeView.js +++ b/src/main/javascript/view/ContentTypeView.js @@ -4,10 +4,8 @@ SwaggerUi.Views.ContentTypeView = Backbone.View.extend({ initialize: function() {}, render: function(){ + this.model.contentTypeId = 'ct' + Math.random(); $(this.el).html(Handlebars.templates.content_type(this.model)); - - $('label[for=contentType]', $(this.el)).text('Response Content Type'); - return this; } }); \ No newline at end of file diff --git a/src/main/javascript/view/ParameterContentTypeView.js b/src/main/javascript/view/ParameterContentTypeView.js index cf33b3ba824..31a192a9393 100644 --- a/src/main/javascript/view/ParameterContentTypeView.js +++ b/src/main/javascript/view/ParameterContentTypeView.js @@ -4,10 +4,8 @@ SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({ initialize: function () {}, render: function(){ + this.model.parameterContentTypeId = 'pct' + Math.random(); $(this.el).html(Handlebars.templates.parameter_content_type(this.model)); - - $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:'); - return this; } diff --git a/src/main/javascript/view/ParameterView.js b/src/main/javascript/view/ParameterView.js index ea7baa126dd..b5079c48e2f 100644 --- a/src/main/javascript/view/ParameterView.js +++ b/src/main/javascript/view/ParameterView.js @@ -31,6 +31,7 @@ SwaggerUi.Views.ParameterView = Backbone.View.extend({ this.model.isBody = this.model.paramType === 'body' || this.model.in === 'body'; this.model.isFile = type && type.toLowerCase() === 'file'; this.model.default = (this.model.default || this.model.defaultValue); + this.model.valueId = 'm' + this.model.name + Math.random(); if (this.model.allowableValues) { this.model.isList = true; @@ -98,4 +99,4 @@ SwaggerUi.Views.ParameterView = Backbone.View.extend({ } } } -}); +}); \ No newline at end of file diff --git a/src/main/javascript/view/ResponseContentTypeView.js b/src/main/javascript/view/ResponseContentTypeView.js index e391cb19b42..41948ab60c7 100644 --- a/src/main/javascript/view/ResponseContentTypeView.js +++ b/src/main/javascript/view/ResponseContentTypeView.js @@ -4,10 +4,8 @@ SwaggerUi.Views.ResponseContentTypeView = Backbone.View.extend({ initialize: function(){}, render: function(){ + this.model.responseContentTypeId = 'rct' + Math.random(); $(this.el).html(Handlebars.templates.response_content_type(this.model)); - - $('label[for=responseContentType]', $(this.el)).text('Response Content Type'); - return this; } }); \ No newline at end of file diff --git a/src/main/template/apikey_button_view.handlebars b/src/main/template/apikey_button_view.handlebars index 756f3707882..998f911a92f 100644 --- a/src/main/template/apikey_button_view.handlebars +++ b/src/main/template/apikey_button_view.handlebars @@ -1,9 +1,9 @@
-
{{keyName}}
- - +
+ +
diff --git a/src/main/template/basic_auth_button_view.handlebars b/src/main/template/basic_auth_button_view.handlebars index 6b82871429f..13497b88e58 100644 --- a/src/main/template/basic_auth_button_view.handlebars +++ b/src/main/template/basic_auth_button_view.handlebars @@ -1,9 +1,9 @@
-
Username
+
-
Password
+
diff --git a/src/main/template/content_type.handlebars b/src/main/template/content_type.handlebars index 063f6a6e11b..c3376a55a0f 100644 --- a/src/main/template/content_type.handlebars +++ b/src/main/template/content_type.handlebars @@ -1,5 +1,5 @@ - - {{#if produces}} {{#each produces}} diff --git a/src/main/template/param.handlebars b/src/main/template/param.handlebars index ebc327d1a71..f1739a8284b 100644 --- a/src/main/template/param.handlebars +++ b/src/main/template/param.handlebars @@ -1,24 +1,24 @@ -{{name}} + {{#if isBody}} {{#if isFile}} - +
{{else}} {{#if default}} - +
{{else}} - +
{{/if}} {{/if}} {{else}} {{#if isFile}} - +
{{else}} {{#renderTextParam this}} diff --git a/src/main/template/param_list.handlebars b/src/main/template/param_list.handlebars index 6957122fde3..69a70b4bd68 100644 --- a/src/main/template/param_list.handlebars +++ b/src/main/template/param_list.handlebars @@ -1,10 +1,6 @@ -{{#if required}} -{{name}} -{{else}} -{{name}} -{{/if}} +