diff --git a/static/api-doc/swagger-ui.js b/static/api-doc/swagger-ui.js deleted file mode 100644 index 591da8ef..00000000 --- a/static/api-doc/swagger-ui.js +++ /dev/null @@ -1,2119 +0,0 @@ -$(function() { - - // Helper function for vertically aligning DOM elements - // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ - $.fn.vAlign = function() { - return this.each(function(i){ - var ah = $(this).height(); - var ph = $(this).parent().height(); - var mh = (ph - ah) / 2; - $(this).css('margin-top', mh); - }); - }; - - $.fn.stretchFormtasticInputWidthToParent = function() { - return this.each(function(i){ - var p_width = $(this).closest("form").innerWidth(); - var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10); - var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10); - $(this).css('width', p_width - p_padding - this_padding); - }); - }; - - $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent(); - - // Vertically center these paragraphs - // Parent may need a min-height for this to work.. - $('ul.downplayed li div.content p').vAlign(); - - // When a sandbox form is submitted.. - $("form.sandbox").submit(function(){ - - var error_free = true; - - // Cycle through the forms required inputs - $(this).find("input.required").each(function() { - - // Remove any existing error styles from the input - $(this).removeClass('error'); - - // Tack the error style on if the input is empty.. - if ($(this).val() == '') { - $(this).addClass('error'); - $(this).wiggle(); - error_free = false; - } - - }); - - return error_free; - }); - -}); - -function clippyCopiedCallback(a) { - $('#api_key_copied').fadeIn().delay(1000).fadeOut(); - - // var b = $("#clippy_tooltip_" + a); - // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() { - // b.attr("title", "copy to clipboard") - // }, - // 500)) -} - -// Logging function that accounts for browsers that don't have window.console -function log() { - if (window.console) console.log.apply(console,arguments); -} -// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913) -if (Function.prototype.bind && console && typeof console.log == "object") { - [ - "log","info","warn","error","assert","dir","clear","profile","profileEnd" - ].forEach(function (method) { - console[method] = this.bind(console[method], console); - }, Function.prototype.call); -} - -var Docs = { - - shebang: function() { - - // If shebang has an operation nickname in it.. - // e.g. /docs/#!/words/get_search - var fragments = $.param.fragment().split('/'); - fragments.shift(); // get rid of the bang - - switch (fragments.length) { - case 1: - // Expand all operations for the resource and scroll to it -// log('shebang resource:' + fragments[0]); - var dom_id = 'resource_' + fragments[0]; - - Docs.expandEndpointListForResource(fragments[0]); - $("#"+dom_id).slideto({highlight: false}); - break; - case 2: - // Refer to the endpoint DOM element, e.g. #words_get_search -// log('shebang endpoint: ' + fragments.join('_')); - - // Expand Resource - Docs.expandEndpointListForResource(fragments[0]); - $("#"+dom_id).slideto({highlight: false}); - - // Expand operation - var li_dom_id = fragments.join('_'); - var li_content_dom_id = li_dom_id + "_content"; - -// log("li_dom_id " + li_dom_id); -// log("li_content_dom_id " + li_content_dom_id); - - Docs.expandOperation($('#'+li_content_dom_id)); - $('#'+li_dom_id).slideto({highlight: false}); - break; - } - - }, - - toggleEndpointListForResource: function(resource) { - var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints'); - if (elem.is(':visible')) { - Docs.collapseEndpointListForResource(resource); - } else { - Docs.expandEndpointListForResource(resource); - } - }, - - // Expand resource - expandEndpointListForResource: function(resource) { - var resource = Docs.escapeResourceName(resource); - if (resource == '') { - $('.resource ul.endpoints').slideDown(); - return; - } - - $('li#resource_' + resource).addClass('active'); - - var elem = $('li#resource_' + resource + ' ul.endpoints'); - elem.slideDown(); - }, - - // Collapse resource and mark as explicitly closed - collapseEndpointListForResource: function(resource) { - var resource = Docs.escapeResourceName(resource); - $('li#resource_' + resource).removeClass('active'); - - var elem = $('li#resource_' + resource + ' ul.endpoints'); - elem.slideUp(); - }, - - expandOperationsForResource: function(resource) { - // Make sure the resource container is open.. - Docs.expandEndpointListForResource(resource); - - if (resource == '') { - $('.resource ul.endpoints li.operation div.content').slideDown(); - return; - } - - $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { - Docs.expandOperation($(this)); - }); - }, - - collapseOperationsForResource: function(resource) { - // Make sure the resource container is open.. - Docs.expandEndpointListForResource(resource); - - $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { - Docs.collapseOperation($(this)); - }); - }, - - escapeResourceName: function(resource) { - return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&"); - }, - - expandOperation: function(elem) { - elem.slideDown(); - }, - - collapseOperation: function(elem) { - elem.slideUp(); - } - -}; -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - return buffer; - } -function program2(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program4(depth0,data) { - - - return "\n \n"; - } - - buffer += "\n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; - -function program1(depth0,data) { - - var buffer = "", stack1, stack2; - buffer += "\n
"; - if (stack1 = helpers.notes) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.notes; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "
\n "; - return buffer; - } - -function program3(depth0,data) { - - - return "\n\n
Parameter | \nValue | \nDescription | \nParameter Type | \nData Type | \n
---|
HTTP Status Code | \nReason | \n
---|
";
- if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- buffer += escapeExpression(stack1)
- + "
\n \n " + this.invocationUrl + ""); - obj = { - type: this.model.method, - url: this.invocationUrl, - headers: headerParams, - data: bodyParam, - dataType: 'json', - contentType: false, - processData: false, - error: function(data, textStatus, error) { - return _this.showErrorStatus(_this.wrap(data), _this); - }, - success: function(data) { - return _this.showResponse(data, _this); - }, - complete: function(data) { - return _this.showCompleteStatus(_this.wrap(data), _this); - } - }; - if (window.authorizations) { - window.authorizations.apply(obj); - } - jQuery.ajax(obj); - return false; - }; - - OperationView.prototype.wrap = function(data) { - var o, - _this = this; - o = {}; - o.content = {}; - o.content.data = data.responseText; - o.getHeaders = function() { - return { - "Content-Type": data.getResponseHeader("Content-Type") - }; - }; - o.request = {}; - o.request.url = this.invocationUrl; - o.status = data.status; - return o; - }; - - OperationView.prototype.getSelectedValue = function(select) { - var opt, options, _i, _len, _ref5; - if (!select.multiple) { - return select.value; - } else { - options = []; - _ref5 = select.options; - for (_i = 0, _len = _ref5.length; _i < _len; _i++) { - opt = _ref5[_i]; - if (opt.selected) { - options.push(opt.value); - } - } - if (options.length > 0) { - return options.join(","); - } else { - return null; - } - } - }; - - OperationView.prototype.hideResponse = function(e) { - if (e != null) { - e.preventDefault(); - } - $(".response", $(this.el)).slideUp(); - return $(".response_hider", $(this.el)).fadeOut(); - }; - - OperationView.prototype.showResponse = function(response) { - var prettyJson; - prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "
').text("no content");
- pre = $('').append(code);
- } else if (contentType.indexOf("application/json") === 0 || contentType.indexOf("application/hal+json") === 0) {
- code = $('
').text(JSON.stringify(JSON.parse(content), null, 2));
- pre = $('').append(code);
- } else if (contentType.indexOf("application/xml") === 0) {
- code = $('
').text(this.formatXml(content));
- pre = $('').append(code);
- } else if (contentType.indexOf("text/html") === 0) {
- code = $('
').html(content);
- pre = $('').append(code);
- } else if (contentType.indexOf("image/") === 0) {
- pre = $('').attr('src', data.request.url);
- } else {
- code = $('
').text(content);
- pre = $('').append(code);
- }
- response_body = pre;
- $(".request_url", $(this.el)).html("" + data.request.url + ""); - $(".response_code", $(this.el)).html("
" + data.status + ""); - $(".response_body", $(this.el)).html(response_body); - $(".response_headers", $(this.el)).html("
" + JSON.stringify(data.getHeaders(), null, " ").replace(/\n/g, ""); - $(".response", $(this.el)).slideDown(); - $(".response_hider", $(this.el)).show(); - $(".response_throbber", $(this.el)).hide(); - return hljs.highlightBlock($('.response_body', $(this.el))[0]); - }; - - OperationView.prototype.toggleOperationContent = function() { - var elem; - elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.method + "_" + this.model.number + "_content"); - if (elem.is(':visible')) { - return Docs.collapseOperation(elem); - } else { - return Docs.expandOperation(elem); - } - }; - - return OperationView; - - })(Backbone.View); - - StatusCodeView = (function(_super) { - __extends(StatusCodeView, _super); - - function StatusCodeView() { - _ref5 = StatusCodeView.__super__.constructor.apply(this, arguments); - return _ref5; - } - - StatusCodeView.prototype.initialize = function() {}; - - StatusCodeView.prototype.render = function() { - var template; - template = this.template(); - $(this.el).html(template(this.model)); - return this; - }; - - StatusCodeView.prototype.template = function() { - return Handlebars.templates.status_code; - }; - - return StatusCodeView; - - })(Backbone.View); - - ParameterView = (function(_super) { - __extends(ParameterView, _super); - - function ParameterView() { - _ref6 = ParameterView.__super__.constructor.apply(this, arguments); - return _ref6; - } - - ParameterView.prototype.initialize = function() {}; - - ParameterView.prototype.render = function() { - var contentTypeModel, isParam, parameterContentTypeView, responseContentTypeView, signatureModel, signatureView, template, type; - type = this.model.type || this.model.dataType; - if (this.model.paramType === 'body') { - this.model.isBody = true; - } - if (type.toLowerCase() === 'file') { - this.model.isFile = true; - } - template = this.template(); - $(this.el).html(template(this.model)); - signatureModel = { - sampleJSON: this.model.sampleJSON, - isParam: true, - signature: this.model.signature - }; - if (this.model.sampleJSON) { - signatureView = new SignatureView({ - model: signatureModel, - tagName: 'div' - }); - $('.model-signature', $(this.el)).append(signatureView.render().el); - } else { - $('.model-signature', $(this.el)).html(this.model.signature); - } - isParam = false; - if (this.model.isBody) { - isParam = true; - } - contentTypeModel = { - isParam: isParam - }; - contentTypeModel.consumes = this.model.consumes; - if (isParam) { - parameterContentTypeView = new ParameterContentTypeView({ - model: contentTypeModel - }); - $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el); - } else { - responseContentTypeView = new ResponseContentTypeView({ - model: contentTypeModel - }); - $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el); - } - return this; - }; - - ParameterView.prototype.template = function() { - if (this.model.isList) { - return Handlebars.templates.param_list; - } else { - if (this.options.readOnly) { - if (this.model.required) { - return Handlebars.templates.param_readonly_required; - } else { - return Handlebars.templates.param_readonly; - } - } else { - if (this.model.required) { - return Handlebars.templates.param_required; - } else { - return Handlebars.templates.param; - } - } - } - }; - - return ParameterView; - - })(Backbone.View); - - SignatureView = (function(_super) { - __extends(SignatureView, _super); - - function SignatureView() { - _ref7 = SignatureView.__super__.constructor.apply(this, arguments); - return _ref7; - } - - SignatureView.prototype.events = { - 'click a.description-link': 'switchToDescription', - 'click a.snippet-link': 'switchToSnippet', - 'mousedown .snippet': 'snippetToTextArea' - }; - - SignatureView.prototype.initialize = function() {}; - - SignatureView.prototype.render = function() { - var template; - template = this.template(); - $(this.el).html(template(this.model)); - this.switchToDescription(); - this.isParam = this.model.isParam; - if (this.isParam) { - $('.notice', $(this.el)).text('Click to set as parameter value'); - } - return this; - }; - - SignatureView.prototype.template = function() { - return Handlebars.templates.signature; - }; - - SignatureView.prototype.switchToDescription = function(e) { - if (e != null) { - e.preventDefault(); - } - $(".snippet", $(this.el)).hide(); - $(".description", $(this.el)).show(); - $('.description-link', $(this.el)).addClass('selected'); - return $('.snippet-link', $(this.el)).removeClass('selected'); - }; - - SignatureView.prototype.switchToSnippet = function(e) { - if (e != null) { - e.preventDefault(); - } - $(".description", $(this.el)).hide(); - $(".snippet", $(this.el)).show(); - $('.snippet-link', $(this.el)).addClass('selected'); - return $('.description-link', $(this.el)).removeClass('selected'); - }; - - SignatureView.prototype.snippetToTextArea = function(e) { - var textArea; - if (this.isParam) { - if (e != null) { - e.preventDefault(); - } - textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode)); - if ($.trim(textArea.val()) === '') { - return textArea.val(this.model.sampleJSON); - } - } - }; - - return SignatureView; - - })(Backbone.View); - - ContentTypeView = (function(_super) { - __extends(ContentTypeView, _super); - - function ContentTypeView() { - _ref8 = ContentTypeView.__super__.constructor.apply(this, arguments); - return _ref8; - } - - ContentTypeView.prototype.initialize = function() {}; - - ContentTypeView.prototype.render = function() { - var template; - template = this.template(); - $(this.el).html(template(this.model)); - $('label[for=contentType]', $(this.el)).text('Response Content Type'); - return this; - }; - - ContentTypeView.prototype.template = function() { - return Handlebars.templates.content_type; - }; - - return ContentTypeView; - - })(Backbone.View); - - ResponseContentTypeView = (function(_super) { - __extends(ResponseContentTypeView, _super); - - function ResponseContentTypeView() { - _ref9 = ResponseContentTypeView.__super__.constructor.apply(this, arguments); - return _ref9; - } - - ResponseContentTypeView.prototype.initialize = function() {}; - - ResponseContentTypeView.prototype.render = function() { - var template; - template = this.template(); - $(this.el).html(template(this.model)); - $('label[for=responseContentType]', $(this.el)).text('Response Content Type'); - return this; - }; - - ResponseContentTypeView.prototype.template = function() { - return Handlebars.templates.response_content_type; - }; - - return ResponseContentTypeView; - - })(Backbone.View); - - ParameterContentTypeView = (function(_super) { - __extends(ParameterContentTypeView, _super); - - function ParameterContentTypeView() { - _ref10 = ParameterContentTypeView.__super__.constructor.apply(this, arguments); - return _ref10; - } - - ParameterContentTypeView.prototype.initialize = function() {}; - - ParameterContentTypeView.prototype.render = function() { - var template; - template = this.template(); - $(this.el).html(template(this.model)); - $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:'); - return this; - }; - - ParameterContentTypeView.prototype.template = function() { - return Handlebars.templates.parameter_content_type; - }; - - return ParameterContentTypeView; - - })(Backbone.View); - -}).call(this); diff --git a/templates/api-docs.html b/templates/api-docs.html index 29dae29a..a75bf57c 100644 --- a/templates/api-docs.html +++ b/templates/api-docs.html @@ -17,7 +17,7 @@ - +
") + "