27 lines
935 B
JavaScript
27 lines
935 B
JavaScript
'use strict';
|
|
|
|
SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
|
|
initialize: function (opts) {
|
|
this.options = opts || {};
|
|
this.router = this.options.router;
|
|
},
|
|
|
|
render: function(){
|
|
$(this.el).html(Handlebars.templates.status_code(this.model));
|
|
|
|
if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
|
|
var responseModel = {
|
|
sampleJSON: JSON.stringify(this.router.api.models[this.model.responseModel].createJSONSample(), null, 2),
|
|
isParam: false,
|
|
signature: this.router.api.models[this.model.responseModel].getMockSignature(),
|
|
defaultRendering: this.model.defaultRendering
|
|
};
|
|
|
|
var responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});
|
|
$('.model-signature', this.$el).append(responseModelView.render().el);
|
|
} else {
|
|
$('.model-signature', this.$el).html('');
|
|
}
|
|
return this;
|
|
}
|
|
}); |