github.com/qubitproducts/logspray@v0.2.14/server/swagger-ui/src/main/javascript/view/StatusCodeView.js (about)

     1  'use strict';
     2  
     3  SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
     4    initialize: function (opts) {
     5      this.options = opts || {};
     6      this.router = this.options.router;
     7    },
     8  
     9    render: function(){
    10      var responseModel, responseModelView;
    11      var value = this.router.api.models[this.model.responseModel];
    12      $(this.el).html(Handlebars.templates.status_code(this.model));
    13  
    14      if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
    15        responseModel = {
    16          sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2),
    17          sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample('', this.model.schema, this.router.api.models) : false,
    18          isParam: false,
    19          signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models),
    20          defaultRendering: this.model.defaultRendering
    21        };
    22      } else {
    23        responseModel = {
    24          signature: SwaggerUi.partials.signature.getPrimitiveSignature(this.model.schema)
    25        };
    26      }
    27  
    28      responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});
    29      $('.model-signature', this.$el).append(responseModelView.render().el);
    30      return this;
    31    }
    32  });