Remove all references to swaggerUi global instance

This commit is contained in:
Mohsen Azimi
2015-03-16 13:52:38 -07:00
parent 79d9d1cf0d
commit 51bbbf03db
7 changed files with 53 additions and 35 deletions

View File

@@ -1,19 +1,19 @@
'use strict';
SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
initialize: function () {
initialize: function (opts) {
this.options = opts || {};
this.router = this.options.router;
},
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)) {
if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
var responseModel = {
sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
sampleJSON: JSON.stringify(this.router.api.models[this.model.responseModel].createJSONSample(), null, 2),
isParam: false,
signature: swaggerUi.api.models[this.model.responseModel].getMockSignature(),
signature: this.router.api.models[this.model.responseModel].getMockSignature(),
};
var responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});