Fix all JSHint errors

This commit is contained in:
Mohsen Azimi
2015-03-12 16:50:57 -07:00
parent 096cd120a4
commit 07ac7fcf95
10 changed files with 22 additions and 20 deletions

View File

@@ -1,3 +1,5 @@
node_modules
test
src/main/javascript/doc.js
dist
lib

View File

@@ -23,13 +23,13 @@
"$": false,
"jQuery": false,
"marked": false,
"HeaderView": false,
"MainView": false,
"Docs": false,
"SwaggerClient": false,
"Handlebars": false,
"ApiKeyAuthorization": false,
"PasswordAuthorization": false,
"hljs": false
"hljs": false,
"SwaggerUi": false,
"swaggerUi": false // TODO: remove me
}
}

12
dist/swagger-ui.js vendored
View File

@@ -200,8 +200,7 @@ window.SwaggerUi = Backbone.Router.extend({
});
window.SwaggerUi.Views = {};
window.SwaggerUi = SwaggerUi;
window.SwaggerUi.Views = {};
this["Handlebars"] = this["Handlebars"] || {};
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
@@ -1159,7 +1158,7 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
update: function(url, apiKey, trigger){
if (trigger === undefined) {
trigger = false
trigger = false;
}
$('#input_baseUrl').val(url);
@@ -1509,7 +1508,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
addStatusCode: function(statusCode) {
// Render status codes
var statusCodeView = new StatusCodeView({model: statusCode, tagName: 'tr'});
var statusCodeView = new SwaggerUi.Views.StatusCodeView({model: statusCode, tagName: 'tr'});
$('.operation-status', $(this.el)).append(statusCodeView.render().el);
},
@@ -2053,7 +2052,7 @@ SwaggerUi.Views.ResourceView = Backbone.View.extend({
operation.nickname = id;
operation.parentId = this.model.id;
this.addOperation(operation);
};
}
$('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
$('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
@@ -2163,7 +2162,7 @@ SwaggerUi.Views.SignatureView = Backbone.View.extend({
});
'use strict';
var StatusCodeView = Backbone.View.extend({
SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
initialize: function () {
},
@@ -2171,6 +2170,7 @@ var StatusCodeView = Backbone.View.extend({
render: function(){
$(this.el).html(Handlebars.templates.status_code(this.model));
// TODO get rid of "swaggerUi" global dependency
if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
var responseModel = {
sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),

File diff suppressed because one or more lines are too long

View File

@@ -96,13 +96,13 @@ gulp.task('copy', ['less'], function() {
gulp
.src(['./lib/**/*.{js,map}'])
.pipe(gulp.dest('./dist/lib'))
.on('error', log)
.on('error', log);
// copy all files inside html folder
gulp
.src(['./src/main/html/**/*'])
.pipe(gulp.dest('./dist'))
.on('error', log)
.on('error', log);
});
/**
@@ -130,4 +130,4 @@ function log(error) {
gulp.task('default', ['dist', 'copy']);
gulp.task('serve', ['connect', 'watch'])
gulp.task('serve', ['connect', 'watch']);

View File

@@ -194,5 +194,4 @@ window.SwaggerUi = Backbone.Router.extend({
});
window.SwaggerUi.Views = {};
window.SwaggerUi = SwaggerUi;
window.SwaggerUi.Views = {};

View File

@@ -42,7 +42,7 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
update: function(url, apiKey, trigger){
if (trigger === undefined) {
trigger = false
trigger = false;
}
$('#input_baseUrl').val(url);

View File

@@ -229,7 +229,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
addStatusCode: function(statusCode) {
// Render status codes
var statusCodeView = new StatusCodeView({model: statusCode, tagName: 'tr'});
var statusCodeView = new SwaggerUi.Views.StatusCodeView({model: statusCode, tagName: 'tr'});
$('.operation-status', $(this.el)).append(statusCodeView.render().el);
},

View File

@@ -34,7 +34,7 @@ SwaggerUi.Views.ResourceView = Backbone.View.extend({
operation.nickname = id;
operation.parentId = this.model.id;
this.addOperation(operation);
};
}
$('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
$('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));

View File

@@ -1,6 +1,6 @@
'use strict';
var StatusCodeView = Backbone.View.extend({
SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
initialize: function () {
},
@@ -8,6 +8,7 @@ var StatusCodeView = Backbone.View.extend({
render: function(){
$(this.el).html(Handlebars.templates.status_code(this.model));
// TODO get rid of "swaggerUi" global dependency
if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
var responseModel = {
sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),