|
@@ -1,5 +1,5 @@
|
|
|
// swagger-ui.js
|
|
|
-// version 2.0.17
|
|
|
+// version 2.0.23
|
|
|
$(function() {
|
|
|
|
|
|
// Helper function for vertically aligning DOM elements
|
|
@@ -68,7 +68,7 @@ log = function(){
|
|
|
log.history = log.history || [];
|
|
|
log.history.push(arguments);
|
|
|
if(this.console){
|
|
|
- console.log( Array.prototype.slice.call(arguments) );
|
|
|
+ console.log( Array.prototype.slice.call(arguments)[0] );
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -240,67 +240,74 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
function program1(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1, stack2;
|
|
|
- buffer += "\n ";
|
|
|
+ buffer += "\n <div class=\"info_title\">"
|
|
|
+ + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
|
+ + "</div>\n <div class=\"info_description\">";
|
|
|
+ stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
|
|
+ if(stack2 || stack2 === 0) { buffer += stack2; }
|
|
|
+ buffer += "</div>\n ";
|
|
|
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
|
|
if(stack2 || stack2 === 0) { buffer += stack2; }
|
|
|
- buffer += "\n ";
|
|
|
+ buffer += "\n ";
|
|
|
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
|
|
|
if(stack2 || stack2 === 0) { buffer += stack2; }
|
|
|
- buffer += "\n ";
|
|
|
+ buffer += "\n ";
|
|
|
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
|
|
if(stack2 || stack2 === 0) { buffer += stack2; }
|
|
|
- buffer += "\n ";
|
|
|
+ buffer += "\n ";
|
|
|
return buffer;
|
|
|
}
|
|
|
function program2(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1;
|
|
|
- buffer += "<li><a href=\""
|
|
|
+ buffer += "<div class=\"info_tos\"><a href=\""
|
|
|
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
|
- + "\" title=\"Terms of Service\"><i class=\"fa fa-lg fa-bullhorn\"></i> Terms</a></li>";
|
|
|
+ + "\">Terms of service</a></div>";
|
|
|
return buffer;
|
|
|
}
|
|
|
|
|
|
function program4(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1;
|
|
|
- buffer += "<li><a href=\"mailto:"
|
|
|
+ buffer += "<div class='info_contact'><a href=\"mailto:"
|
|
|
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
|
- + "\"><i class=\"fa fa-lg fa-send\"></i> Contact</a></li>";
|
|
|
+ + "\">Contact the developer</a></div>";
|
|
|
return buffer;
|
|
|
}
|
|
|
|
|
|
function program6(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1;
|
|
|
- buffer += "<li><a href=\""
|
|
|
+ buffer += "<div class='info_license'><a href='"
|
|
|
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.licenseUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
|
- + "\" title=\""
|
|
|
+ + "'>"
|
|
|
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
|
- + "\"><i class=\"fa fa-lg fa-certificate\"></i> License</a></li>";
|
|
|
+ + "</a></div>";
|
|
|
return buffer;
|
|
|
}
|
|
|
|
|
|
function program8(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1;
|
|
|
- buffer += " v";
|
|
|
+ buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
|
|
|
if (stack1 = helpers.apiVersion) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.apiVersion; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
- buffer += escapeExpression(stack1);
|
|
|
+ buffer += escapeExpression(stack1)
|
|
|
+ + "\n ";
|
|
|
return buffer;
|
|
|
}
|
|
|
|
|
|
- buffer += "<div class='info' id='api_info'>\n</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <ul id=\"footer-nav\">\n ";
|
|
|
+ buffer += "<div class='info' id='api_info'>\n ";
|
|
|
stack1 = helpers['if'].call(depth0, depth0.info, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
|
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
|
- buffer += "\n <li>\n ";
|
|
|
+ buffer += "\n</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
|
|
|
if (stack1 = helpers.basePath) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.basePath; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
- buffer += escapeExpression(stack1);
|
|
|
+ buffer += escapeExpression(stack1)
|
|
|
+ + "\n ";
|
|
|
stack1 = helpers['if'].call(depth0, depth0.apiVersion, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
|
|
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
|
- buffer += " Powered by Restler & Swagger\n </li>\n </ul>\n </div>\n</div>\n";
|
|
|
+ buffer += "]</h4>\n </div>\n</div>\n";
|
|
|
return buffer;
|
|
|
});
|
|
|
})();
|
|
@@ -389,7 +396,7 @@ function program18(depth0,data) {
|
|
|
function program20(depth0,data) {
|
|
|
|
|
|
|
|
|
- return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n ";
|
|
|
+ return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n ";
|
|
|
}
|
|
|
|
|
|
buffer += "\n <ul class='operations' >\n <li class='";
|
|
@@ -555,7 +562,7 @@ function program9(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1;
|
|
|
buffer += "\n ";
|
|
|
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
|
|
|
+ stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(10, program10, data),fn:self.program(2, program2, data),data:data});
|
|
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
|
buffer += "\n ";
|
|
|
return buffer;
|
|
@@ -563,7 +570,16 @@ function program9(depth0,data) {
|
|
|
function program10(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1;
|
|
|
- buffer += "\n <input class='parameter' minlength='0' name='";
|
|
|
+ buffer += "\n ";
|
|
|
+ stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(13, program13, data),fn:self.program(11, program11, data),data:data});
|
|
|
+ if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
|
+ buffer += "\n ";
|
|
|
+ return buffer;
|
|
|
+ }
|
|
|
+function program11(depth0,data) {
|
|
|
+
|
|
|
+ var buffer = "", stack1;
|
|
|
+ buffer += "\n <input class='parameter' minlength='0' name='";
|
|
|
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
@@ -571,18 +587,18 @@ function program10(depth0,data) {
|
|
|
if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "'/>\n ";
|
|
|
+ + "'/>\n ";
|
|
|
return buffer;
|
|
|
}
|
|
|
|
|
|
-function program12(depth0,data) {
|
|
|
+function program13(depth0,data) {
|
|
|
|
|
|
var buffer = "", stack1;
|
|
|
- buffer += "\n <input class='parameter' minlength='0' name='";
|
|
|
+ buffer += "\n <input class='parameter' minlength='0' name='";
|
|
|
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "' placeholder='' type='text' value=''/>\n ";
|
|
|
+ + "' placeholder='' type='text' value=''/>\n ";
|
|
|
return buffer;
|
|
|
}
|
|
|
|
|
@@ -1057,23 +1073,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
|
|
|
function program1(depth0,data) {
|
|
|
|
|
|
- var buffer = "", stack1;
|
|
|
- buffer += " : ";
|
|
|
- if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
- else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
- if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
|
- return buffer;
|
|
|
+
|
|
|
+ return " : ";
|
|
|
}
|
|
|
|
|
|
buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
|
|
|
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "' onclick=\"Docs.toggleEndpointListForResource('";
|
|
|
+ + "' class=\"toggleEndpointList\" data-id=\"";
|
|
|
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "');\">";
|
|
|
+ + "\">";
|
|
|
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
@@ -1083,6 +1095,9 @@ function program1(depth0,data) {
|
|
|
else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
if (!helpers.description) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
|
|
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
|
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
+ if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
|
buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
|
|
|
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
@@ -1091,19 +1106,19 @@ function program1(depth0,data) {
|
|
|
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "'\n onclick=\"Docs.toggleEndpointListForResource('";
|
|
|
+ + "' class=\"toggleEndpointList\" data-id=\"";
|
|
|
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
|
|
|
+ + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\"";
|
|
|
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
|
|
|
+ + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=";
|
|
|
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
|
- + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
|
|
|
+ + ">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
|
|
|
if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
|
|
else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
|
|
buffer += escapeExpression(stack1)
|
|
@@ -1203,18 +1218,18 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
|
|
|
|
|
|
|
|
|
-// Generated by CoffeeScript 1.5.0
|
|
|
+// Generated by CoffeeScript 1.6.3
|
|
|
(function() {
|
|
|
- var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi,
|
|
|
+ var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
|
|
|
__hasProp = {}.hasOwnProperty,
|
|
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
|
|
|
|
|
SwaggerUi = (function(_super) {
|
|
|
-
|
|
|
__extends(SwaggerUi, _super);
|
|
|
|
|
|
function SwaggerUi() {
|
|
|
- SwaggerUi.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref = SwaggerUi.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref;
|
|
|
}
|
|
|
|
|
|
SwaggerUi.prototype.dom_id = "swagger_ui";
|
|
@@ -1263,9 +1278,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
};
|
|
|
|
|
|
SwaggerUi.prototype.load = function() {
|
|
|
- var url, _ref;
|
|
|
- if ((_ref = this.mainView) != null) {
|
|
|
- _ref.clear();
|
|
|
+ var url, _ref1;
|
|
|
+ if ((_ref1 = this.mainView) != null) {
|
|
|
+ _ref1.clear();
|
|
|
}
|
|
|
url = this.options.url;
|
|
|
if (url.indexOf("http") !== 0) {
|
|
@@ -1281,10 +1296,10 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
SwaggerUi.prototype.render = function() {
|
|
|
var _this = this;
|
|
|
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
|
|
|
- this.headerView.updateInfo(this.api.info);
|
|
|
this.mainView = new MainView({
|
|
|
model: this.api,
|
|
|
- el: $('#' + this.dom_id)
|
|
|
+ el: $('#' + this.dom_id),
|
|
|
+ swaggerOptions: this.options
|
|
|
}).render();
|
|
|
this.showMessage();
|
|
|
switch (this.options.docExpansion) {
|
|
@@ -1355,11 +1370,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
window.SwaggerUi = SwaggerUi;
|
|
|
|
|
|
HeaderView = (function(_super) {
|
|
|
-
|
|
|
__extends(HeaderView, _super);
|
|
|
|
|
|
function HeaderView() {
|
|
|
- HeaderView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref1 = HeaderView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref1;
|
|
|
}
|
|
|
|
|
|
HeaderView.prototype.events = {
|
|
@@ -1412,40 +1427,56 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- HeaderView.prototype.updateInfo = function(info) {
|
|
|
- if (info.title != null) {
|
|
|
- $('#logo').text(info.title);
|
|
|
- }
|
|
|
- if (info.description != null) {
|
|
|
- $('#logo').attr('title', info.description);
|
|
|
- }
|
|
|
- if (info.termsOfServiceUrl != null) {
|
|
|
- return $('#logo').attr('href', info.termsOfServiceUrl);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
return HeaderView;
|
|
|
|
|
|
})(Backbone.View);
|
|
|
|
|
|
MainView = (function(_super) {
|
|
|
+ var sorters;
|
|
|
|
|
|
__extends(MainView, _super);
|
|
|
|
|
|
function MainView() {
|
|
|
- MainView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref2 = MainView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref2;
|
|
|
}
|
|
|
|
|
|
- MainView.prototype.initialize = function() {};
|
|
|
+ sorters = {
|
|
|
+ 'alpha': function(a, b) {
|
|
|
+ return a.path.localeCompare(b.path);
|
|
|
+ },
|
|
|
+ 'method': function(a, b) {
|
|
|
+ return a.method.localeCompare(b.method);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ MainView.prototype.initialize = function(opts) {
|
|
|
+ var route, sorter, sorterName, _i, _len, _ref3;
|
|
|
+ if (opts == null) {
|
|
|
+ opts = {};
|
|
|
+ }
|
|
|
+ if (opts.swaggerOptions.sorter) {
|
|
|
+ sorterName = opts.swaggerOptions.sorter;
|
|
|
+ sorter = sorters[sorterName];
|
|
|
+ _ref3 = this.model.apisArray;
|
|
|
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
|
|
|
+ route = _ref3[_i];
|
|
|
+ route.operationsArray.sort(sorter);
|
|
|
+ }
|
|
|
+ if (sorterName === "alpha") {
|
|
|
+ return this.model.apisArray.sort(sorter);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
MainView.prototype.render = function() {
|
|
|
- var counter, id, resource, resources, _i, _len, _ref;
|
|
|
+ var counter, id, resource, resources, _i, _len, _ref3;
|
|
|
$(this.el).html(Handlebars.templates.main(this.model));
|
|
|
resources = {};
|
|
|
counter = 0;
|
|
|
- _ref = this.model.apisArray;
|
|
|
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
|
- resource = _ref[_i];
|
|
|
+ _ref3 = this.model.apisArray;
|
|
|
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
|
|
|
+ resource = _ref3[_i];
|
|
|
id = resource.name;
|
|
|
while (typeof resources[id] !== 'undefined') {
|
|
|
id = id + "_" + counter;
|
|
@@ -1464,7 +1495,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
model: resource,
|
|
|
tagName: 'li',
|
|
|
id: 'resource_' + resource.id,
|
|
|
- className: 'resource'
|
|
|
+ className: 'resource',
|
|
|
+ swaggerOptions: this.options.swaggerOptions
|
|
|
});
|
|
|
return $('#resources').append(resourceView.render().el);
|
|
|
};
|
|
@@ -1478,22 +1510,22 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
})(Backbone.View);
|
|
|
|
|
|
ResourceView = (function(_super) {
|
|
|
-
|
|
|
__extends(ResourceView, _super);
|
|
|
|
|
|
function ResourceView() {
|
|
|
- ResourceView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref3 = ResourceView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref3;
|
|
|
}
|
|
|
|
|
|
ResourceView.prototype.initialize = function() {};
|
|
|
|
|
|
ResourceView.prototype.render = function() {
|
|
|
- var counter, id, methods, operation, _i, _len, _ref;
|
|
|
+ var counter, id, methods, operation, _i, _len, _ref4;
|
|
|
$(this.el).html(Handlebars.templates.resource(this.model));
|
|
|
methods = {};
|
|
|
- _ref = this.model.operationsArray;
|
|
|
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
|
- operation = _ref[_i];
|
|
|
+ _ref4 = this.model.operationsArray;
|
|
|
+ for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
|
|
|
+ operation = _ref4[_i];
|
|
|
counter = 0;
|
|
|
id = operation.nickname;
|
|
|
while (typeof methods[id] !== 'undefined') {
|
|
@@ -1505,6 +1537,10 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
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'));
|
|
|
+ /* DOL_CHANGE LDR Fix typo error that break expand */
|
|
|
+ $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
|
|
|
return this;
|
|
|
};
|
|
|
|
|
@@ -1514,22 +1550,28 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
operationView = new OperationView({
|
|
|
model: operation,
|
|
|
tagName: 'li',
|
|
|
- className: 'endpoint'
|
|
|
+ className: 'endpoint',
|
|
|
+ swaggerOptions: this.options.swaggerOptions
|
|
|
});
|
|
|
$('.endpoints', $(this.el)).append(operationView.render().el);
|
|
|
return this.number++;
|
|
|
};
|
|
|
|
|
|
+ ResourceView.prototype.callDocs = function(fnName, e) {
|
|
|
+ e.preventDefault();
|
|
|
+ return Docs[fnName](e.currentTarget.getAttribute('data-id'));
|
|
|
+ };
|
|
|
+
|
|
|
return ResourceView;
|
|
|
|
|
|
})(Backbone.View);
|
|
|
|
|
|
OperationView = (function(_super) {
|
|
|
-
|
|
|
__extends(OperationView, _super);
|
|
|
|
|
|
function OperationView() {
|
|
|
- OperationView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref4 = OperationView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref4;
|
|
|
}
|
|
|
|
|
|
OperationView.prototype.invocationUrl = null;
|
|
@@ -1548,8 +1590,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
OperationView.prototype.mouseEnter = function(e) {
|
|
|
var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
|
|
|
elem = $(e.currentTarget.parentNode).find('#api_information_panel');
|
|
|
- x = event.pageX;
|
|
|
- y = event.pageY;
|
|
|
+ x = e.pageX;
|
|
|
+ y = e.pageY;
|
|
|
scX = $(window).scrollLeft();
|
|
|
scY = $(window).scrollTop();
|
|
|
scMaxX = scX + $(window).width();
|
|
@@ -1580,16 +1622,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
};
|
|
|
|
|
|
OperationView.prototype.render = function() {
|
|
|
- var contentTypeModel, isMethodSubmissionSupported, k, o, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, v, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
|
|
|
+ var contentTypeModel, isMethodSubmissionSupported, k, o, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, v, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8;
|
|
|
isMethodSubmissionSupported = true;
|
|
|
if (!isMethodSubmissionSupported) {
|
|
|
this.model.isReadOnly = true;
|
|
|
}
|
|
|
this.model.oauth = null;
|
|
|
if (this.model.authorizations) {
|
|
|
- _ref = this.model.authorizations;
|
|
|
- for (k in _ref) {
|
|
|
- v = _ref[k];
|
|
|
+ _ref5 = this.model.authorizations;
|
|
|
+ for (k in _ref5) {
|
|
|
+ v = _ref5[k];
|
|
|
if (k === "oauth2") {
|
|
|
if (this.model.oauth === null) {
|
|
|
this.model.oauth = {};
|
|
@@ -1624,9 +1666,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
};
|
|
|
contentTypeModel.consumes = this.model.consumes;
|
|
|
contentTypeModel.produces = this.model.produces;
|
|
|
- _ref1 = this.model.parameters;
|
|
|
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
|
|
- param = _ref1[_j];
|
|
|
+ _ref6 = this.model.parameters;
|
|
|
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
|
|
|
+ param = _ref6[_j];
|
|
|
type = param.type || param.dataType;
|
|
|
if (type.toLowerCase() === 'file') {
|
|
|
if (!contentTypeModel.consumes) {
|
|
@@ -1639,14 +1681,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
model: contentTypeModel
|
|
|
});
|
|
|
$('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
|
|
|
- _ref2 = this.model.parameters;
|
|
|
- for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
|
|
- param = _ref2[_k];
|
|
|
+ _ref7 = this.model.parameters;
|
|
|
+ for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
|
|
|
+ param = _ref7[_k];
|
|
|
this.addParameter(param, contentTypeModel.consumes);
|
|
|
}
|
|
|
- _ref3 = this.model.responseMessages;
|
|
|
- for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
|
|
|
- statusCode = _ref3[_l];
|
|
|
+ _ref8 = this.model.responseMessages;
|
|
|
+ for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
|
|
|
+ statusCode = _ref8[_l];
|
|
|
this.addStatusCode(statusCode);
|
|
|
}
|
|
|
return this;
|
|
@@ -1673,7 +1715,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
};
|
|
|
|
|
|
OperationView.prototype.submitOperation = function(e) {
|
|
|
- var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
|
|
|
+ var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
|
|
|
if (e != null) {
|
|
|
e.preventDefault();
|
|
|
}
|
|
@@ -1698,9 +1740,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
parent: this
|
|
|
};
|
|
|
isFileUpload = false;
|
|
|
- _ref = form.find("input");
|
|
|
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
|
- o = _ref[_i];
|
|
|
+ _ref5 = form.find("input");
|
|
|
+ for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
|
|
|
+ o = _ref5[_i];
|
|
|
if ((o.value != null) && jQuery.trim(o.value).length > 0) {
|
|
|
map[o.name] = o.value;
|
|
|
}
|
|
@@ -1708,16 +1750,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
isFileUpload = true;
|
|
|
}
|
|
|
}
|
|
|
- _ref1 = form.find("textarea");
|
|
|
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
|
|
- o = _ref1[_j];
|
|
|
+ _ref6 = form.find("textarea");
|
|
|
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
|
|
|
+ o = _ref6[_j];
|
|
|
if ((o.value != null) && jQuery.trim(o.value).length > 0) {
|
|
|
map["body"] = o.value;
|
|
|
}
|
|
|
}
|
|
|
- _ref2 = form.find("select");
|
|
|
- for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
|
|
- o = _ref2[_k];
|
|
|
+ _ref7 = form.find("select");
|
|
|
+ for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
|
|
|
+ o = _ref7[_k];
|
|
|
val = this.getSelectedValue(o);
|
|
|
if ((val != null) && jQuery.trim(val).length > 0) {
|
|
|
map[o.name] = val;
|
|
@@ -1739,46 +1781,46 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
};
|
|
|
|
|
|
OperationView.prototype.handleFileUpload = function(map, form) {
|
|
|
- var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3,
|
|
|
+ var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
|
|
|
_this = this;
|
|
|
- _ref = form.serializeArray();
|
|
|
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
|
- o = _ref[_i];
|
|
|
+ _ref5 = form.serializeArray();
|
|
|
+ for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
|
|
|
+ o = _ref5[_i];
|
|
|
if ((o.value != null) && jQuery.trim(o.value).length > 0) {
|
|
|
map[o.name] = o.value;
|
|
|
}
|
|
|
}
|
|
|
bodyParam = new FormData();
|
|
|
params = 0;
|
|
|
- _ref1 = this.model.parameters;
|
|
|
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
|
|
- param = _ref1[_j];
|
|
|
+ _ref6 = this.model.parameters;
|
|
|
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
|
|
|
+ param = _ref6[_j];
|
|
|
if (param.paramType === 'form') {
|
|
|
- if (map[param.name] !== void 0) {
|
|
|
+ if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
|
|
|
bodyParam.append(param.name, map[param.name]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
headerParams = {};
|
|
|
- _ref2 = this.model.parameters;
|
|
|
- for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
|
|
- param = _ref2[_k];
|
|
|
+ _ref7 = this.model.parameters;
|
|
|
+ for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
|
|
|
+ param = _ref7[_k];
|
|
|
if (param.paramType === 'header') {
|
|
|
headerParams[param.name] = map[param.name];
|
|
|
}
|
|
|
}
|
|
|
log(headerParams);
|
|
|
- _ref3 = form.find('input[type~="file"]');
|
|
|
- for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
|
|
|
- el = _ref3[_l];
|
|
|
+ _ref8 = form.find('input[type~="file"]');
|
|
|
+ for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
|
|
|
+ el = _ref8[_l];
|
|
|
if (typeof el.files[0] !== 'undefined') {
|
|
|
bodyParam.append($(el).attr('name'), el.files[0]);
|
|
|
params += 1;
|
|
|
}
|
|
|
}
|
|
|
- log(bodyParam);
|
|
|
this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
|
|
|
- $(".request_url", $(this.el)).html("<pre>" + this.invocationUrl + "</pre>");
|
|
|
+ $(".request_url", $(this.el)).html("<pre></pre>");
|
|
|
+ $(".request_url pre", $(this.el)).text(this.invocationUrl);
|
|
|
obj = {
|
|
|
type: this.model.method,
|
|
|
url: this.invocationUrl,
|
|
@@ -1829,14 +1871,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
};
|
|
|
|
|
|
OperationView.prototype.getSelectedValue = function(select) {
|
|
|
- var opt, options, _i, _len, _ref;
|
|
|
+ var opt, options, _i, _len, _ref5;
|
|
|
if (!select.multiple) {
|
|
|
return select.value;
|
|
|
} else {
|
|
|
options = [];
|
|
|
- _ref = select.options;
|
|
|
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
|
- opt = _ref[_i];
|
|
|
+ _ref5 = select.options;
|
|
|
+ for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
|
|
|
+ opt = _ref5[_i];
|
|
|
if (opt.selected) {
|
|
|
options.push(opt.value);
|
|
|
}
|
|
@@ -1924,9 +1966,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
padding = '';
|
|
|
indent += transitions[fromTo];
|
|
|
padding = ((function() {
|
|
|
- var _j, _ref, _results;
|
|
|
+ var _j, _ref5, _results;
|
|
|
_results = [];
|
|
|
- for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
|
|
|
+ for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
|
|
|
_results.push(' ');
|
|
|
}
|
|
|
return _results;
|
|
@@ -1945,7 +1987,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
};
|
|
|
|
|
|
OperationView.prototype.showStatus = function(response) {
|
|
|
- var code, content, contentType, headers, pre, response_body, url;
|
|
|
+ var code, content, contentType, headers, opts, pre, response_body, response_body_el, url;
|
|
|
if (response.content === void 0) {
|
|
|
content = response.data;
|
|
|
url = response.url;
|
|
@@ -1974,14 +2016,21 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
pre = $('<pre class="json" />').append(code);
|
|
|
}
|
|
|
response_body = pre;
|
|
|
- $(".request_url", $(this.el)).html("<pre>" + url + "</pre>");
|
|
|
+ $(".request_url", $(this.el)).html("<pre></pre>");
|
|
|
+ $(".request_url pre", $(this.el)).text(url);
|
|
|
$(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
|
|
|
$(".response_body", $(this.el)).html(response_body);
|
|
|
- $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>");
|
|
|
+ $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
|
|
|
$(".response", $(this.el)).slideDown();
|
|
|
$(".response_hider", $(this.el)).show();
|
|
|
$(".response_throbber", $(this.el)).hide();
|
|
|
- return hljs.highlightBlock($('.response_body', $(this.el))[0]);
|
|
|
+ response_body_el = $('.response_body', $(this.el))[0];
|
|
|
+ opts = this.options.swaggerOptions;
|
|
|
+ if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
|
|
|
+ return response_body_el;
|
|
|
+ } else {
|
|
|
+ return hljs.highlightBlock(response_body_el);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
OperationView.prototype.toggleOperationContent = function() {
|
|
@@ -1999,11 +2048,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
})(Backbone.View);
|
|
|
|
|
|
StatusCodeView = (function(_super) {
|
|
|
-
|
|
|
__extends(StatusCodeView, _super);
|
|
|
|
|
|
function StatusCodeView() {
|
|
|
- StatusCodeView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref5 = StatusCodeView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref5;
|
|
|
}
|
|
|
|
|
|
StatusCodeView.prototype.initialize = function() {};
|
|
@@ -2038,11 +2087,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
})(Backbone.View);
|
|
|
|
|
|
ParameterView = (function(_super) {
|
|
|
-
|
|
|
__extends(ParameterView, _super);
|
|
|
|
|
|
function ParameterView() {
|
|
|
- ParameterView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref6 = ParameterView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref6;
|
|
|
}
|
|
|
|
|
|
ParameterView.prototype.initialize = function() {
|
|
@@ -2127,11 +2176,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
})(Backbone.View);
|
|
|
|
|
|
SignatureView = (function(_super) {
|
|
|
-
|
|
|
__extends(SignatureView, _super);
|
|
|
|
|
|
function SignatureView() {
|
|
|
- SignatureView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref7 = SignatureView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref7;
|
|
|
}
|
|
|
|
|
|
SignatureView.prototype.events = {
|
|
@@ -2146,7 +2195,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
var template;
|
|
|
template = this.template();
|
|
|
$(this.el).html(template(this.model));
|
|
|
- this.switchToDescription();
|
|
|
+ this.switchToSnippet();
|
|
|
this.isParam = this.model.isParam;
|
|
|
if (this.isParam) {
|
|
|
$('.notice', $(this.el)).text('Click to set as parameter value');
|
|
@@ -2196,11 +2245,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
})(Backbone.View);
|
|
|
|
|
|
ContentTypeView = (function(_super) {
|
|
|
-
|
|
|
__extends(ContentTypeView, _super);
|
|
|
|
|
|
function ContentTypeView() {
|
|
|
- ContentTypeView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref8 = ContentTypeView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref8;
|
|
|
}
|
|
|
|
|
|
ContentTypeView.prototype.initialize = function() {};
|
|
@@ -2222,11 +2271,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
})(Backbone.View);
|
|
|
|
|
|
ResponseContentTypeView = (function(_super) {
|
|
|
-
|
|
|
__extends(ResponseContentTypeView, _super);
|
|
|
|
|
|
function ResponseContentTypeView() {
|
|
|
- ResponseContentTypeView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref9 = ResponseContentTypeView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref9;
|
|
|
}
|
|
|
|
|
|
ResponseContentTypeView.prototype.initialize = function() {};
|
|
@@ -2248,11 +2297,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
|
})(Backbone.View);
|
|
|
|
|
|
ParameterContentTypeView = (function(_super) {
|
|
|
-
|
|
|
__extends(ParameterContentTypeView, _super);
|
|
|
|
|
|
function ParameterContentTypeView() {
|
|
|
- ParameterContentTypeView.__super__.constructor.apply(this, arguments);
|
|
|
+ _ref10 = ParameterContentTypeView.__super__.constructor.apply(this, arguments);
|
|
|
+ return _ref10;
|
|
|
}
|
|
|
|
|
|
ParameterContentTypeView.prototype.initialize = function() {};
|