Convert view/StatusCodeView.coffee

This commit is contained in:
Mohsen Azimi
2015-03-12 11:40:54 -07:00
parent dc4e595eed
commit a11fd8b4c6

View File

@@ -0,0 +1,25 @@
'use strict';
var StatusCodeView = Backbone.View.extend({
initialize: function () {
},
render: function(){
$(this.el).html(Handlebars.templates.status_code(this.model));
if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
var responseModel = {
sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
isParam: false,
signature: swaggerUi.api.models[this.model.responseModel].getMockSignature(),
};
var responseModelView = new SignatureView({model: responseModel, tagName: 'div'});
$('.model-signature', this.$el).append(responseModelView.render().el);
} else {
$('.model-signature', this.$el).html('');
}
return this;
}
});