From f35fa5553fdc45b23ff1c81e60ae9b48c1e7a2bc Mon Sep 17 00:00:00 2001 From: Joe Wolf Date: Fri, 8 May 2015 22:35:49 -0400 Subject: [PATCH] 508 Fixes (#1021) Addresses #1021 mostly by adding label tags, generating unique element ids as needed. In the process, moved the label text that gets set in the ___ContentTypeView.js files to the respective handlebar templates; the text was static as far as I could tell. There are additional minor 508 improvements that can be made with the tables (scope tags, header attributes) --- src/main/javascript/view/ContentTypeView.js | 4 +--- .../javascript/view/ParameterContentTypeView.js | 4 +--- src/main/javascript/view/ParameterView.js | 1 + .../javascript/view/ResponseContentTypeView.js | 4 +--- src/main/template/content_type.handlebars | 4 ++-- src/main/template/param.handlebars | 14 +++++++------- src/main/template/param_list.handlebars | 6 +++--- src/main/template/param_readonly.handlebars | 4 ++-- .../template/param_readonly_required.handlebars | 4 ++-- src/main/template/param_required.handlebars | 14 +++++++------- .../template/parameter_content_type.handlebars | 4 ++-- src/main/template/response_content_type.handlebars | 4 ++-- 12 files changed, 31 insertions(+), 36 deletions(-) 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 ba0cb6388a3..070c9732173 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; 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/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 8d3f6731d0e..c4943f7df0d 100644 --- a/src/main/template/param.handlebars +++ b/src/main/template/param.handlebars @@ -1,30 +1,30 @@ -{{name}} + {{#if isBody}} {{#if isFile}} - +
{{else}} {{#if default}} - +
{{else}} - +
{{/if}} {{/if}} {{else}} {{#if isFile}} - +
{{else}} {{#if default}} - + {{else}} - + {{/if}} {{/if}} {{/if}} diff --git a/src/main/template/param_list.handlebars b/src/main/template/param_list.handlebars index e4b1923a6fd..699dfc61fba 100644 --- a/src/main/template/param_list.handlebars +++ b/src/main/template/param_list.handlebars @@ -1,9 +1,9 @@ {{#if required}} -{{name}} + {{/if}} -{{name}} + - {{#if required}} {{else}} {{#if default}} diff --git a/src/main/template/param_readonly.handlebars b/src/main/template/param_readonly.handlebars index bc961974896..284ebbe496e 100644 --- a/src/main/template/param_readonly.handlebars +++ b/src/main/template/param_readonly.handlebars @@ -1,7 +1,7 @@ -{{name}} + {{#if isBody}} - + {{else}} {{#if default}} {{default}} diff --git a/src/main/template/param_readonly_required.handlebars b/src/main/template/param_readonly_required.handlebars index 091ee4d6d04..ab000ec90f0 100644 --- a/src/main/template/param_readonly_required.handlebars +++ b/src/main/template/param_readonly_required.handlebars @@ -1,7 +1,7 @@ -{{name}} + {{#if isBody}} - + {{else}} {{#if default}} {{default}} diff --git a/src/main/template/param_required.handlebars b/src/main/template/param_required.handlebars index d98a537a84a..82a55b47e98 100644 --- a/src/main/template/param_required.handlebars +++ b/src/main/template/param_required.handlebars @@ -1,27 +1,27 @@ -{{name}} + {{#if isBody}} {{#if isFile}} - + {{else}} {{#if default}} - +
{{else}} - +
{{/if}} {{/if}} {{else}} {{#if isFile}} - + {{else}} {{#if default}} - + {{else}} - + {{/if}} {{/if}} {{/if}} diff --git a/src/main/template/parameter_content_type.handlebars b/src/main/template/parameter_content_type.handlebars index a986d576d93..9a8b663aba3 100644 --- a/src/main/template/parameter_content_type.handlebars +++ b/src/main/template/parameter_content_type.handlebars @@ -1,5 +1,5 @@ - - {{#if consumes}} {{#each consumes}} diff --git a/src/main/template/response_content_type.handlebars b/src/main/template/response_content_type.handlebars index 4909a44d428..7f35f670d0c 100644 --- a/src/main/template/response_content_type.handlebars +++ b/src/main/template/response_content_type.handlebars @@ -1,5 +1,5 @@ - - {{#if produces}} {{#each produces}}