You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ha...@apache.org on 2015/11/19 00:43:06 UTC
[22/24] incubator-brooklyn git commit: Added static Swagger UI due to
js dependency issue
Added static Swagger UI due to js dependency issue
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/63c575d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/63c575d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/63c575d1
Branch: refs/heads/master
Commit: 63c575d1233853c5563e84ce8555cc4942a67d9e
Parents: 95da81e
Author: Mark McKenna <m4...@gmail.com>
Authored: Tue Nov 17 14:54:30 2015 +0000
Committer: Mark McKenna <m4...@gmail.com>
Committed: Wed Nov 18 12:06:09 2015 +0000
----------------------------------------------------------------------
usage/dist/licensing/overrides.yaml | 52 +-
usage/jsgui/pom.xml | 9 +-
usage/jsgui/src/main/license/files/LICENSE | 54 +-
.../src/main/license/source-inclusions.yaml | 1 +
.../src/main/webapp/assets/html/swagger-ui.html | 78 +
.../main/webapp/assets/js/libs/swagger-ui.js | 1410 ------------------
.../src/main/webapp/assets/js/libs/swagger.js | 708 ---------
usage/jsgui/src/main/webapp/assets/js/router.js | 16 +-
.../src/main/webapp/assets/js/view/apidoc.js | 82 -
.../main/webapp/assets/swagger-ui/css/print.css | 1195 +++++++++++++++
.../main/webapp/assets/swagger-ui/css/reset.css | 144 ++
.../webapp/assets/swagger-ui/css/screen.css | 1301 ++++++++++++++++
.../main/webapp/assets/swagger-ui/css/style.css | 269 ++++
.../webapp/assets/swagger-ui/css/typography.css | 45 +
.../fonts/droid-sans-v6-latin-700.eot | Bin 0 -> 22922 bytes
.../fonts/droid-sans-v6-latin-700.svg | 411 +++++
.../fonts/droid-sans-v6-latin-700.ttf | Bin 0 -> 40513 bytes
.../fonts/droid-sans-v6-latin-700.woff | Bin 0 -> 25992 bytes
.../fonts/droid-sans-v6-latin-700.woff2 | Bin 0 -> 11480 bytes
.../fonts/droid-sans-v6-latin-regular.eot | Bin 0 -> 22008 bytes
.../fonts/droid-sans-v6-latin-regular.svg | 403 +++++
.../fonts/droid-sans-v6-latin-regular.ttf | Bin 0 -> 39069 bytes
.../fonts/droid-sans-v6-latin-regular.woff | Bin 0 -> 24868 bytes
.../fonts/droid-sans-v6-latin-regular.woff2 | Bin 0 -> 11304 bytes
.../assets/swagger-ui/images/explorer_icons.png | Bin 0 -> 5763 bytes
.../assets/swagger-ui/images/pet_store_api.png | Bin 0 -> 824 bytes
.../assets/swagger-ui/images/throbber.gif | Bin 0 -> 9257 bytes
.../assets/swagger-ui/images/wordnik_api.png | Bin 0 -> 980 bytes
.../assets/swagger-ui/lib/backbone-min.js | 34 +
.../assets/swagger-ui/lib/handlebars-2.0.0.js | 20 +
.../assets/swagger-ui/lib/jquery-1.8.0.min.js | 21 +
.../assets/swagger-ui/lib/jquery.ba-bbq.min.js | 29 +
.../assets/swagger-ui/lib/jquery.wiggle.min.js | 27 +
.../main/webapp/assets/swagger-ui/lib/marked.js | 1285 ++++++++++++++++
.../assets/swagger-ui/lib/swagger-ui.min.js | 37 +
.../assets/swagger-ui/lib/underscore-min.js | 25 +
.../assets/swagger-ui/lib/underscore-min.map | 1 +
usage/jsgui/src/main/webapp/index.html | 32 +-
.../brooklyn/rest/filter/SwaggerFilter.java | 66 +-
39 files changed, 5470 insertions(+), 2285 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63c575d1/usage/dist/licensing/overrides.yaml
----------------------------------------------------------------------
diff --git a/usage/dist/licensing/overrides.yaml b/usage/dist/licensing/overrides.yaml
index b37d5d6..308c0ae 100644
--- a/usage/dist/licensing/overrides.yaml
+++ b/usage/dist/licensing/overrides.yaml
@@ -90,6 +90,21 @@
- " Available at http://sizzlejs.com"
- " Used under the MIT license"
+- id: jquery-core:1.8.0
+ url: http://jquery.com/
+ description: JS library for manipulating HTML and eventing
+ name: jQuery JavaScript Library
+ files: jquery.js
+ version: 1.8.0
+ organization: { name: "The jQuery Foundation", url: "http://jquery.org/" }
+ license: MIT
+ notices:
+ - Copyright (c) The jQuery Foundation, Inc. and other contributors (2005-2012)
+ - "Includes code fragments from sizzle.js:"
+ # NB: sizzle copyright changed from Dojo Foundation in 1.7.2
+ - " Copyright (c) The jQuery Foundation, Inc. and other contributors (2012)"
+ - " Available at http://sizzlejs.com"
+ - " Used under the MIT license"
# used in docs (not reported)
- id: jquery-core:2.1.1
url: http://jquery.com/
@@ -107,19 +122,19 @@
- " Available at http://sizzlejs.com"
- " Used under the MIT license"
-- id: swagger
+- id: swagger:2.1.6
name: Swagger JS
- files: swagger.js
- version: 1.0.1
- url: https://github.com/wordnik/swagger-js
+ files: swagger-client.js
+ version: 2.1.6
+ url: https://github.com/swagger-api/swagger-js
license: ASL2
notice: Copyright (c) SmartBear Software (2011-2015)
-- id: swagger-ui
+- id: swagger-ui:2.1.3
files: swagger-ui.js
name: Swagger UI
- version: 1.0.1
- url: https://github.com/wordnik/swagger-ui
+ version: 2.1.3
+ url: https://github.com/swagger-api/swagger-ui
license: ASL2
notice: Copyright (c) SmartBear Software (2011-2015)
@@ -179,6 +194,13 @@
notice: Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2010-2013)
license: MIT
+- id: backbone.js:1.1.2
+ version: 1.1.2
+ url: http://backbonejs.org
+ organization: { name: "DocumentCloud Inc.", url: "http://www.documentcloud.org/" }
+ notice: Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2010-2014)
+ license: MIT
+
- id: bootstrap.js
version: 2.0.4
url: http://twitter.github.com/bootstrap/javascript.html#transitions
@@ -226,6 +248,14 @@
notice: Copyright (c) Yehuda Katz (2012)
license: MIT
+- id: handlebars.js:2.0.0
+ files: handlebars*.js
+ version: 2.0.0
+ url: https://github.com/wycats/handlebars.js
+ organization: { name: "Yehuda Katz", url: "https://github.com/wycats/" }
+ notice: Copyright (c) Yehuda Katz (2014)
+ license: MIT
+
- id: jquery.ba-bbq.js
name: "jQuery BBQ: Back Button & Query Library"
files: jquery.ba-bbq*.js
@@ -292,6 +322,14 @@
notice: Copyright (c) Twitter, Inc. and other contributors (2013-2014)
license: MIT
+# used for CLI to build catalog
+- id: marked.js
+ version: 0.3.1
+ url: https://github.com/chjj/marked
+ organization: { name: "Christopher Jeffrey", url: "https://github.com/chjj" }
+ notice: Copyright (c) Christopher Jeffrey (2011-2014)
+ license: MIT
+
# DOCS files
#
# we don't do a distributable docs build -- they are just online.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63c575d1/usage/jsgui/pom.xml
----------------------------------------------------------------------
diff --git a/usage/jsgui/pom.xml b/usage/jsgui/pom.xml
index 7ec8c4c..852ec33 100644
--- a/usage/jsgui/pom.xml
+++ b/usage/jsgui/pom.xml
@@ -7,9 +7,9 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -271,6 +271,11 @@
<exclude>**/src/build/requirejs-maven-plugin/r.js</exclude>
<!--
+ Copy of swagger-ui from https://github.com/swagger-api/swagger-ui tag::v2.1.3
+ -->
+ <exclude>**/src/main/webapp/assets/swagger-ui/**</exclude>
+
+ <!--
Trivial Json controlling the build, "without any degree of creativity".
Json does not support comments, therefore far easier to just omit the license header!
-->
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63c575d1/usage/jsgui/src/main/license/files/LICENSE
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/license/files/LICENSE b/usage/jsgui/src/main/license/files/LICENSE
index b1e94b8..4a1f38b 100644
--- a/usage/jsgui/src/main/license/files/LICENSE
+++ b/usage/jsgui/src/main/license/files/LICENSE
@@ -208,6 +208,13 @@ This project includes the software: backbone.js
Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2010-2013)
+This project includes the software: backbone.js
+ Available at: http://backbonejs.org
+ Developed by: DocumentCloud Inc. (http://www.documentcloud.org/)
+ Version used: 1.1.2
+ Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
+ Copyright (c) Jeremy Ashkenas, DocumentCloud (2010-2014)
+
This project includes the software: bootstrap.js
Available at: http://twitter.github.com/bootstrap/javascript.html#transitions
Version used: 2.0.4
@@ -222,6 +229,14 @@ This project includes the software: handlebars.js
Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
Copyright (c) Yehuda Katz (2012)
+This project includes the software: handlebars.js
+ Available at: https://github.com/wycats/handlebars.js
+ Developed by: Yehuda Katz (https://github.com/wycats/)
+ Inclusive of: handlebars*.js
+ Version used: 2.0.0
+ Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
+ Copyright (C) by Yehuda Katz (2011-2014)
+
This project includes the software: jQuery JavaScript Library
Available at: http://jquery.com/
Developed by: The jQuery Foundation (http://jquery.org/)
@@ -234,6 +249,18 @@ This project includes the software: jQuery JavaScript Library
Available at http://sizzlejs.com
Used under the MIT license
+This project includes the software: jQuery JavaScript Library
+ Available at: http://jquery.com/
+ Developed by: The jQuery Foundation (http://jquery.org/)
+ Inclusive of: jquery.js
+ Version used: 1.8.0
+ Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
+ Copyright (c) jQuery Foundation and other contributors (2012)
+ Includes code fragments from sizzle.js:
+ Copyright (c) The Dojo Foundation
+ Available at http://sizzlejs.com
+ Used under the MIT license
+
This project includes the software: jQuery BBQ: Back Button & Query Library
Available at: http://benalman.com/projects/jquery-bbq-plugin/
Developed by: "Cowboy" Ben Alman (http://benalman.com/)
@@ -324,18 +351,18 @@ This project includes the software: RequireJS (r.js maven plugin)
Used under the BSD 2-Clause license.
This project includes the software: Swagger JS
- Available at: https://github.com/wordnik/swagger-js
+ Available at: https://github.com/swagger-api/swagger-js
Inclusive of: swagger.js
- Version used: 1.0.1
+ Version used: 2.1.6
Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
- Copyright (c) SmartBear Software (2011-2015)
+ Copyright (c) SmartBear Software (2015)
This project includes the software: Swagger UI
- Available at: https://github.com/wordnik/swagger-ui
+ Available at: https://github.com/swagger-api/swagger-ui
Inclusive of: swagger-ui.js
- Version used: 1.0.1
+ Version used: 2.1.3
Used under the following license: Apache License, version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
- Copyright (c) SmartBear Software (2011-2015)
+ Copyright (c) SmartBear Software (2015)
This project includes the software: underscore.js
Available at: http://underscorejs.org
@@ -345,6 +372,14 @@ This project includes the software: underscore.js
Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
Copyright (c) Jeremy Ashkenas, DocumentCloud Inc. (2009-2013)
+This project includes the software: underscore.js
+ Available at: http://underscorejs.org
+ Developed by: DocumentCloud Inc. (http://www.documentcloud.org/)
+ Inclusive of: underscore*.{js,map}
+ Version used: 1.7.0
+ Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
+ Copyright (c) Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors (2009-2014)
+
This project includes the software: ZeroClipboard
Available at: http://zeroclipboard.org/
Developed by: ZeroClipboard contributors (https://github.com/zeroclipboard)
@@ -353,6 +388,13 @@ This project includes the software: ZeroClipboard
Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
Copyright (c) Jon Rohan, James M. Greene (2014)
+This project includes the software: marked.js
+ Available at: https://github.com/chjj/marked
+ Developed by: Christopher Jeffrey (https://github.com/chjj)
+ Inclusive of: marked.js
+ Version used: 0.3.1
+ Used under the following license: The MIT License (http://opensource.org/licenses/MIT)
+ Copyright (c) Christopher Jeffrey (2011-2014)
---------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63c575d1/usage/jsgui/src/main/license/source-inclusions.yaml
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/license/source-inclusions.yaml b/usage/jsgui/src/main/license/source-inclusions.yaml
index 9534646..2adf949 100644
--- a/usage/jsgui/src/main/license/source-inclusions.yaml
+++ b/usage/jsgui/src/main/license/source-inclusions.yaml
@@ -38,3 +38,4 @@
- id: js-uri
- id: js-yaml.js
- id: jquery.form.js
+- id: marked.js
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63c575d1/usage/jsgui/src/main/webapp/assets/html/swagger-ui.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/html/swagger-ui.html b/usage/jsgui/src/main/webapp/assets/html/swagger-ui.html
new file mode 100644
index 0000000..499c855
--- /dev/null
+++ b/usage/jsgui/src/main/webapp/assets/html/swagger-ui.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+<!-- Brooklyn SHA-1: GIT_SHA_1 -->
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Brooklyn API Docs</title>
+ <link rel="icon" type="image/x-icon" href="/favicon.ico" sizes="16x16"/>
+ <link href='../swagger-ui/css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='../swagger-ui/css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='../swagger-ui/css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='../swagger-ui/css/reset.css' media='print' rel='stylesheet' type='text/css'/>
+ <link href='../swagger-ui/css/print.css' media='print' rel='stylesheet' type='text/css'/>
+ <link href='../swagger-ui/css/style.css' media='print' rel='stylesheet' type='text/css'/>
+ <script src='../swagger-ui/lib/jquery-1.8.0.min.js' type='text/javascript'></script>
+ <script src='../swagger-ui/lib/jquery.wiggle.min.js' type='text/javascript'></script>
+ <script src='../swagger-ui/lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
+ <script src='../swagger-ui/lib/handlebars-2.0.0.js' type='text/javascript'></script>
+ <script src='../swagger-ui/lib/underscore-min.js' type='text/javascript'></script>
+ <script src='../swagger-ui/lib/backbone-min.js' type='text/javascript'></script>
+ <script src='../swagger-ui/lib/swagger-ui.min.js' type='text/javascript'></script>
+ <script src='../swagger-ui/lib/marked.js' type='text/javascript'></script>
+
+ <script type="text/javascript">
+ $(function () {
+ window.swaggerUi = new SwaggerUi({
+ url: "/v1/apidoc/swagger.json",
+ dom_id: "swagger-ui-container",
+ supportHeaderParams: false,
+ supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
+ onComplete: function (swaggerApi, swaggerUi) {
+ log("Brooklyn swagger api doc loaded");
+ },
+ onFailure: function (data) {
+ log("Unable to Load SwaggerUI");
+ },
+ docExpansion: "none",
+ apisSorter: "alpha",
+ showRequestHeaders: false
+ });
+ window.swaggerUi.load();
+
+ function log() {
+ if ('console' in window) {
+ console.log.apply(console, arguments);
+ }
+ }
+ });
+ </script>
+ <style>
+ #validator {
+ display: none;
+ }
+ </style>
+</head>
+
+<body class="swagger-section">
+<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
+<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63c575d1/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js b/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js
deleted file mode 100644
index cb08e3c..0000000
--- a/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js
+++ /dev/null
@@ -1,1410 +0,0 @@
-// brooklyn note: from https://github.com/wordnik/swagger-ui, apache 2.0 license
-
-$(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);
-}
-
-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[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints');
- if (elem.is(':visible')) {
- Docs.collapseEndpointListForResource(resource);
- } else {
- Docs.expandEndpointListForResource(resource);
- }
- },
-
- // Expand resource
- expandEndpointListForResource: function(resource) {
- $('[id^=resource_' + Docs.escapeResourceName(resource) + ']').addClass('active');
-
- var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints');
- elem.slideDown();
- },
-
- // Collapse resource and mark as explicitly closed
- collapseEndpointListForResource: function(resource) {
- $('[id^=resource_' + Docs.escapeResourceName(resource) + ']').removeClass('active');
-
- var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints');
- elem.slideUp();
- },
-
- expandOperationsForResource: function(resource) {
- // Make sure the resource container is open..
- Docs.expandEndpointListForResource(resource);
- $('li[id^=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[id^=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['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
- // suppress footer
- buffer += "\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>: ";
-// foundHelper = helpers.basePath;
-// stack1 = foundHelper || depth0.basePath;
-// if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
-// else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "basePath", { hash: {} }); }
-// buffer += escapeExpression(stack1) + "]</h4>\n </div>\n</div>";
- return buffer;});
-})();
-
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <h4>Implementation Notes</h4>\n <p>";
- foundHelper = helpers.notes;
- stack1 = foundHelper || depth0.notes;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "notes", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</p>\n ";
- return buffer;}
-
-function program3(depth0,data) {
-
- var buffer = "", stack1, stack2;
- foundHelper = helpers.responseClassSignature;
- stack1 = foundHelper || depth0.responseClassSignature;
- if (stack1 !== "ok") {
- buffer += "\n <h4>Response Class</h4>\n ";
- stack2 = helpers['if'];
- tmp1 = self.program(4, program4, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(6, program6, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- }
- return buffer;}
-function program4(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <p><span class=\"model-signature\">";
- foundHelper = helpers.responseClassSignature;
- stack1 = foundHelper || depth0.responseClassSignature;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "responseClassSignature", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</span></p>\n ";
- return buffer;}
-
-function program6(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <p>";
- foundHelper = helpers.responseClass;
- stack1 = foundHelper || depth0.responseClass;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "responseClass", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</p>\n ";
- return buffer;}
-
-function program8(depth0,data) {
-
-
- return "\n ";}
-
-function program10(depth0,data) {
-
-
- return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a swag='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='/assets/images/throbber.gif' style='display:none' />\n </div>\n ";}
-
- buffer += "\n <ul class='operations' >\n <li class='";
- foundHelper = helpers.httpMethod;
- stack1 = foundHelper || depth0.httpMethod;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
- buffer += escapeExpression(stack1) + " operation' id='";
- foundHelper = helpers.resourceName;
- stack1 = foundHelper || depth0.resourceName;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_";
- foundHelper = helpers.nickname;
- stack1 = foundHelper || depth0.nickname;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_";
- foundHelper = helpers.httpMethod;
- stack1 = foundHelper || depth0.httpMethod;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a swag='#!/";
- foundHelper = helpers.resourceName;
- stack1 = foundHelper || depth0.resourceName;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
- buffer += escapeExpression(stack1) + "/";
- foundHelper = helpers.nickname;
- stack1 = foundHelper || depth0.nickname;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_";
- foundHelper = helpers.httpMethod;
- stack1 = foundHelper || depth0.httpMethod;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
- foundHelper = helpers.httpMethod;
- stack1 = foundHelper || depth0.httpMethod;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</a>\n </span>\n <span class='path'>\n <a swag='#!/";
- foundHelper = helpers.resourceName;
- stack1 = foundHelper || depth0.resourceName;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
- buffer += escapeExpression(stack1) + "/";
- foundHelper = helpers.nickname;
- stack1 = foundHelper || depth0.nickname;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_";
- foundHelper = helpers.httpMethod;
- stack1 = foundHelper || depth0.httpMethod;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
- foundHelper = helpers.path;
- stack1 = foundHelper || depth0.path;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "path", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a swag='#!/";
- foundHelper = helpers.resourceName;
- stack1 = foundHelper || depth0.resourceName;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
- buffer += escapeExpression(stack1) + "/";
- foundHelper = helpers.nickname;
- stack1 = foundHelper || depth0.nickname;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_";
- foundHelper = helpers.httpMethod;
- stack1 = foundHelper || depth0.httpMethod;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
- foundHelper = helpers.summary;
- stack1 = foundHelper || depth0.summary;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "summary", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
- foundHelper = helpers.resourceName;
- stack1 = foundHelper || depth0.resourceName;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_";
- foundHelper = helpers.nickname;
- stack1 = foundHelper || depth0.nickname;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_";
- foundHelper = helpers.httpMethod;
- stack1 = foundHelper || depth0.httpMethod;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_content' style='display:none'>\n ";
- foundHelper = helpers.notes;
- stack1 = foundHelper || depth0.notes;
- stack2 = helpers['if'];
- tmp1 = self.program(1, program1, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.noop;
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- foundHelper = helpers.responseClass;
- stack1 = foundHelper || depth0.responseClass;
- stack2 = helpers['if'];
- tmp1 = self.program(3, program3, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.noop;
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\" >Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 320px; max-width: 330px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";
- foundHelper = helpers.isReadOnly;
- stack1 = foundHelper || depth0.isReadOnly;
- stack2 = helpers['if'];
- tmp1 = self.program(8, program8, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(10, program10, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";
- return buffer;});
-})();
-
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1, stack2;
- buffer += "\n ";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- stack2 = helpers['if'];
- tmp1 = self.program(2, program2, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(4, program4, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n \n ";
- return buffer;}
-function program2(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <textarea class='body-textarea' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</textarea>\n ";
- return buffer;}
-
-function program4(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <textarea class='body-textarea' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'></textarea>\n ";
- return buffer;}
-
-function program6(depth0,data) {
-
- var buffer = "", stack1, stack2;
- buffer += "\n ";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- stack2 = helpers['if'];
- tmp1 = self.program(7, program7, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(9, program9, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- return buffer;}
-function program7(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <input minlength='0' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' placeholder='' type='text' value='";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'/>\n ";
- return buffer;}
-
-function program9(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <input minlength='0' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' placeholder='' type='text' value=''/>\n ";
- return buffer;}
-
- buffer += "<td class='code'>";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</td>\n<td>\n \n ";
- foundHelper = helpers.isBody;
- stack1 = foundHelper || depth0.isBody;
- stack2 = helpers['if'];
- tmp1 = self.program(1, program1, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(6, program6, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n\n</td>\n<td>";
- foundHelper = helpers.description;
- stack1 = foundHelper || depth0.description;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</td>\n<td>\n <span class=\"model-signature\">";
- foundHelper = helpers.signature;
- stack1 = foundHelper || depth0.signature;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</span>\n</td>\n\n";
- return buffer;});
-})();
-
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-function program1(depth0,data) {
-
-
- return "\n ";}
-
-function program3(depth0,data) {
-
- var buffer = "", stack1, stack2;
- buffer += "\n ";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- stack2 = helpers['if'];
- tmp1 = self.program(4, program4, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(6, program6, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- return buffer;}
-function program4(depth0,data) {
-
-
- return "\n ";}
-
-function program6(depth0,data) {
-
-
- return "\n <option selected=\"\" value=''></option>\n ";}
-
-function program8(depth0,data) {
-
- var buffer = "", stack1, stack2;
- buffer += "\n ";
- foundHelper = helpers.isDefault;
- stack1 = foundHelper || depth0.isDefault;
- stack2 = helpers['if'];
- tmp1 = self.program(9, program9, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(11, program11, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- return buffer;}
-function program9(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <option value='";
- foundHelper = helpers.value;
- stack1 = foundHelper || depth0.value;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>";
- foundHelper = helpers.value;
- stack1 = foundHelper || depth0.value;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
- buffer += escapeExpression(stack1) + " (default)</option>\n ";
- return buffer;}
-
-function program11(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <option value='";
- foundHelper = helpers.value;
- stack1 = foundHelper || depth0.value;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>";
- foundHelper = helpers.value;
- stack1 = foundHelper || depth0.value;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</option>\n ";
- return buffer;}
-
- buffer += "<td class='code'>";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</td>\n<td>\n <select name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>\n ";
- foundHelper = helpers.required;
- stack1 = foundHelper || depth0.required;
- stack2 = helpers['if'];
- tmp1 = self.program(1, program1, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(3, program3, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- foundHelper = helpers.allowableValues;
- stack1 = foundHelper || depth0.allowableValues;
- stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.descriptiveValues);
- stack2 = helpers.each;
- tmp1 = self.program(8, program8, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.noop;
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n </select>\n</td>\n<td>";
- foundHelper = helpers.description;
- stack1 = foundHelper || depth0.description;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</td>\n<td><span class=\"model-signature\">";
- foundHelper = helpers.signature;
- stack1 = foundHelper || depth0.signature;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</span></td>";
- return buffer;});
-})();
-
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</textarea>\n ";
- return buffer;}
-
-function program3(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n ";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "\n ";
- return buffer;}
-
- buffer += "<td class='code'>";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
- foundHelper = helpers.isBody;
- stack1 = foundHelper || depth0.isBody;
- stack2 = helpers['if'];
- tmp1 = self.program(1, program1, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(3, program3, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n</td>\n<td>";
- foundHelper = helpers.description;
- stack1 = foundHelper || depth0.description;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</td>\n<td><span class=\"model-signature\">";
- foundHelper = helpers.signature;
- stack1 = foundHelper || depth0.signature;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</span></td>\n";
- return buffer;});
-})();
-
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</textarea>\n ";
- return buffer;}
-
-function program3(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n ";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "\n ";
- return buffer;}
-
- buffer += "<td class='code required'>";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
- foundHelper = helpers.isBody;
- stack1 = foundHelper || depth0.isBody;
- stack2 = helpers['if'];
- tmp1 = self.program(1, program1, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(3, program3, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n</td>\n<td>";
- foundHelper = helpers.description;
- stack1 = foundHelper || depth0.description;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</td>\n<td><span class=\"model-signature\">";
- foundHelper = helpers.signature;
- stack1 = foundHelper || depth0.signature;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</span></td>";
- return buffer;});
-})();
-
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1, stack2;
- buffer += "\n ";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- stack2 = helpers['if'];
- tmp1 = self.program(2, program2, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(4, program4, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n \n ";
- return buffer;}
-function program2(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</textarea>\n ";
- return buffer;}
-
-function program4(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'></textarea>\n ";
- return buffer;}
-
-function program6(depth0,data) {
-
- var buffer = "", stack1, stack2;
- buffer += "\n ";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- stack2 = helpers['if'];
- tmp1 = self.program(7, program7, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(9, program9, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- return buffer;}
-function program7(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <input class='required' minlength='1' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value='";
- foundHelper = helpers.defaultValue;
- stack1 = foundHelper || depth0.defaultValue;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'/>\n ";
- return buffer;}
-
-function program9(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <input class='required' minlength='1' name='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value=''/>\n ";
- return buffer;}
-
- buffer += "<td class='code required'>";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
- foundHelper = helpers.isBody;
- stack1 = foundHelper || depth0.isBody;
- stack2 = helpers['if'];
- tmp1 = self.program(1, program1, data);
- tmp1.hash = {};
- tmp1.fn = tmp1;
- tmp1.inverse = self.program(6, program6, data);
- stack1 = stack2.call(depth0, stack1, tmp1);
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n</td>\n<td>\n <strong>";
- foundHelper = helpers.description;
- stack1 = foundHelper || depth0.description;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</strong>\n</td>\n<td><span class=\"model-signature\">";
- foundHelper = helpers.signature;
- stack1 = foundHelper || depth0.signature;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</span></td>";
- return buffer;});
-})();
-
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-
- buffer += "<div class='heading'>\n <h2>\n <a swag='#!/";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' onclick=\"Docs.toggleEndpointListForResource('";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "');\">";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "</a>\n </h2>\n <ul class='options'>\n <li>\n <a swag='#!/";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "' id='endpointListTogger_";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'\n onclick=\"Docs.toggleEndpointListForResource('";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "');\">+/-</a>\n </li>\n <li>\n <a swag='#' onclick=\"Docs.collapseOperationsForResource('";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'); return false;\">\n +\n </a>\n </li>\n <li>\n <a swag='#' onclick=\"Docs.expandOperationsForResource('";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'); return false;\">\n ++\n </a>\n </li>\n <li>\n <a href='";
- foundHelper = helpers.url;
- stack1 = foundHelper || depth0.url;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "url", { hash: {} }); }
- buffer += escapeExpression(stack1) + "'>raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
- foundHelper = helpers.name;
- stack1 = foundHelper || depth0.name;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
- buffer += escapeExpression(stack1) + "_endpoint_list' style='display:none'>\n\n</ul>\n";
- return buffer;});
-})();
-
-
-
-// Generated by CoffeeScript 1.3.3
-(function() {
- var HeaderView, MainView, OperationView, ParameterView, ResourceView, SwaggerUi,
- __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() {
- return SwaggerUi.__super__.constructor.apply(this, arguments);
- }
-
- SwaggerUi.prototype.dom_id = "swagger_ui";
-
- SwaggerUi.prototype.options = null;
-
- SwaggerUi.prototype.api = null;
-
- SwaggerUi.prototype.headerView = null;
-
- SwaggerUi.prototype.mainView = null;
-
- SwaggerUi.prototype.initialize = function(options) {
- var _this = this;
- if (options == null) {
- options = {};
- }
- if (options.dom_id != null) {
- this.dom_id = options.dom_id;
- delete options.dom_id;
- }
- if (!($('#' + this.dom_id) != null)) {
- $('body').append('<div id="' + this.dom_id + '"></div>');
- }
- this.options = options;
- this.options.success = function() {
- return _this.render();
- };
- this.options.progress = function(d) {
- return _this.showMessage(d);
- };
- this.options.failure = function(d) {
- return _this.onLoadFailure(d);
- };
- this.headerView = new HeaderView({
- el: $('#header')
- });
- return this.headerView.on('update-swagger-ui', function(data) {
- return _this.updateSwaggerUi(data);
- });
- };
-
- SwaggerUi.prototype.updateSwaggerUi = function(data) {
- this.options.discoveryUrl = data.discoveryUrl;
- this.options.apiKey = data.apiKey;
- return this.load();
- };
-
- SwaggerUi.prototype.load = function() {
- var _ref;
- if ((_ref = this.mainView) != null) {
- _ref.clear();
- }
- this.headerView.update(this.options.discoveryUrl, this.options.apiKey);
- return this.api = new SwaggerApi(this.options);
- };
-
- SwaggerUi.prototype.render = function() {
- var _this = this;
- this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
- this.mainView = new MainView({
- model: this.api,
- el: $('#' + this.dom_id)
- }).render();
- this.showMessage();
- switch (this.options.docExpansion) {
- case "full":
- Docs.expandOperationsForResource('');
- break;
- case "list":
- Docs.collapseOperationsForResource('');
- }
- if (this.options.onComplete) {
- this.options.onComplete(this.api, this);
- }
- return setTimeout(function() {
- return Docs.shebang();
- }, 400);
- };
-
- SwaggerUi.prototype.showMessage = function(data) {
- if (data == null) {
- data = '';
- }
- $('#message-bar').removeClass('message-fail');
- $('#message-bar').addClass('message-success');
- return $('#message-bar').html(data);
- };
-
- SwaggerUi.prototype.onLoadFailure = function(data) {
- var val;
- if (data == null) {
- data = '';
- }
- $('#message-bar').removeClass('message-success');
- $('#message-bar').addClass('message-fail');
- val = $('#message-bar').html(data);
- if (this.options.onFailure != null) {
- this.options.onFailure(data);
- }
- return val;
- };
-
- return SwaggerUi;
-
- })(Backbone.Router);
-
- window.SwaggerUi = SwaggerUi;
-
- HeaderView = (function(_super) {
-
- __extends(HeaderView, _super);
-
- function HeaderView() {
- return HeaderView.__super__.constructor.apply(this, arguments);
- }
-
- HeaderView.prototype.events = {
- 'click #show-pet-store-icon': 'showPetStore',
- 'click #show-wordnik-dev-icon': 'showWordnikDev',
- 'click #explore': 'showCustom',
- 'keyup #input_baseUrl': 'showCustomOnKeyup',
- 'keyup #input_apiKey': 'showCustomOnKeyup'
- };
-
- HeaderView.prototype.initialize = function() {};
-
- HeaderView.prototype.showPetStore = function(e) {
- return this.trigger('update-swagger-ui', {
- discoveryUrl: "http://petstore.swagger.wordnik.com/api/resources.json",
- apiKey: "special-key"
- });
- };
-
- HeaderView.prototype.showWordnikDev = function(e) {
- return this.trigger('update-swagger-ui', {
- discoveryUrl: "http://api.wordnik.com/v4/resources.json",
- apiKey: ""
- });
- };
-
- HeaderView.prototype.showCustomOnKeyup = function(e) {
- if (e.keyCode === 13) {
- return this.showCustom();
- }
- };
-
- HeaderView.prototype.showCustom = function(e) {
- if (e != null) {
- e.preventDefault();
- }
- return this.trigger('update-swagger-ui', {
- discoveryUrl: $('#input_baseUrl').val(),
- apiKey: $('#input_apiKey').val()
- });
- };
-
- HeaderView.prototype.update = function(url, apiKey, trigger) {
- if (trigger == null) {
- trigger = false;
- }
- $('#input_baseUrl').val(url);
- $('#input_apiKey').val(apiKey);
- if (trigger) {
- return this.trigger('update-swagger-ui', {
- discoveryUrl: url,
- apiKey: apiKey
- });
- }
- };
-
- return HeaderView;
-
- })(Backbone.View);
-
- MainView = (function(_super) {
-
- __extends(MainView, _super);
-
- function MainView() {
- return MainView.__super__.constructor.apply(this, arguments);
- }
-
- MainView.prototype.initialize = function() {};
-
- MainView.prototype.render = function() {
- var resource, _i, _len, _ref;
- $(this.el).html(Handlebars.templates.main(this.model));
- _ref = this.model.resourcesArray;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- resource = _ref[_i];
- this.addResource(resource);
- }
- return this;
- };
-
- MainView.prototype.addResource = function(resource) {
- var resourceView;
- resourceView = new ResourceView({
- model: resource,
- tagName: 'li',
- id: 'resource_' + resource.name,
- className: 'resource'
- });
- return $('#resources').append(resourceView.render().el);
- };
-
- MainView.prototype.clear = function() {
- return $(this.el).html('');
- };
-
- return MainView;
-
- })(Backbone.View);
-
- ResourceView = (function(_super) {
-
- __extends(ResourceView, _super);
-
- function ResourceView() {
- return ResourceView.__super__.constructor.apply(this, arguments);
- }
-
- ResourceView.prototype.initialize = function() {};
-
- ResourceView.prototype.render = function() {
- var operation, _i, _len, _ref;
- $(this.el).html(Handlebars.templates.resource(this.model));
- _ref = this.model.operationsArray;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- operation = _ref[_i];
- this.addOperation(operation);
- }
- return this;
- };
-
- ResourceView.prototype.addOperation = function(operation) {
- var operationView;
- operationView = new OperationView({
- model: operation,
- tagName: 'li',
- className: 'endpoint'
- });
- return $('.endpoints', $(this.el)).append(operationView.render().el);
- };
-
- return ResourceView;
-
- })(Backbone.View);
-
- OperationView = (function(_super) {
-
- __extends(OperationView, _super);
-
- function OperationView() {
- return OperationView.__super__.constructor.apply(this, arguments);
- }
-
- OperationView.prototype.events = {
- 'submit .sandbox': 'submitOperation',
- 'click .submit': 'submitOperation',
- 'click .response_hider': 'hideResponse',
- 'click .toggleOperation': 'toggleOperationContent'
- };
-
- OperationView.prototype.initialize = function() {};
-
- OperationView.prototype.render = function() {
- var isMethodSubmissionSupported, param, _i, _len, _ref;
- isMethodSubmissionSupported = jQuery.inArray(this.model.httpMethod, this.model.supportedSubmitMethods()) >= 0;
- if (!isMethodSubmissionSupported) {
- this.model.isReadOnly = true;
- }
- $(this.el).html(Handlebars.templates.operation(this.model));
- _ref = this.model.parameters;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- param = _ref[_i];
- this.addParameter(param);
- }
- return this;
- };
-
- OperationView.prototype.addParameter = function(param) {
- var paramView;
- paramView = new ParameterView({
- model: param,
- tagName: 'tr',
- readOnly: this.model.isReadOnly
- });
- return $('.operation-params', $(this.el)).append(paramView.render().el);
- };
-
- OperationView.prototype.submitOperation = function(e) {
- var bodyParam, error_free, form, headerParams, invocationUrl, map, o, obj, param, _i, _j, _len, _len1, _ref, _ref1,
- _this = this;
- if (e != null) {
- e.preventDefault();
- }
- form = $('.sandbox', $(this.el));
- error_free = true;
- form.find("input.required").each(function() {
- var _this = this;
- $(this).removeClass("error");
- if (jQuery.trim($(this).val()) === "") {
- $(this).addClass("error");
- $(this).wiggle({
- callback: function() {
- return $(_this).focus();
- }
- });
- return error_free = false;
- }
- });
- if (error_free) {
- map = {};
- _ref = form.serializeArray();
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- o = _ref[_i];
- if ((o.value != null) && jQuery.trim(o.value).length > 0) {
- map[o.name] = o.value;
- }
- }
- bodyParam = null;
- _ref1 = this.model.parameters;
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
- param = _ref1[_j];
- if (param.paramType === 'body') {
- bodyParam = map[param.name];
- }
- }
- log("bodyParam = " + bodyParam);
- headerParams = null;
- invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
- log('submitting ' + invocationUrl);
- $(".request_url", $(this.el)).html("<pre>" + invocationUrl + "</pre>");
- $(".response_throbber", $(this.el)).show();
- obj = {
- type: this.model.httpMethod,
- url: invocationUrl,
- headers: headerParams,
- data: bodyParam,
- dataType: 'json',
- error: function(xhr, textStatus, error) {
- return _this.showErrorStatus(xhr, textStatus, error);
- },
- success: function(data) {
- return _this.showResponse(data);
- },
- complete: function(data) {
- return _this.showCompleteStatus(data);
- }
- };
- if (obj.type.toLowerCase() === "put" || obj.type.toLowerCase() === "patch") {
- obj.contentType = "application/json";
- }
- jQuery.ajax(obj);
- return false;
- }
- };
-
- 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, "<br>");
- return $(".response_body", $(this.el)).html(prettyJson);
- };
-
- OperationView.prototype.showErrorStatus = function(data) {
- return this.showStatus(data);
- };
-
- OperationView.prototype.showCompleteStatus = function(data) {
- return this.showStatus(data);
- };
-
- OperationView.prototype.showStatus = function(data) {
- var response_body;
- try {
- response_body = "<pre>" + JSON.stringify(JSON.parse(data.responseText), null, 2).replace(/\n/g, "<br>") + "</pre>";
- } catch (error) {
- response_body = "<span style='color:red'> [unable to parse as json; raw response below]</span><br><pre>" + data.responseText + "</pre>";
- }
- $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
- $(".response_body", $(this.el)).html(response_body);
- $(".response_headers", $(this.el)).html("<pre>" + data.getAllResponseHeaders() + "</pre>");
- $(".response", $(this.el)).slideDown();
- $(".response_hider", $(this.el)).show();
- return $(".response_throbber", $(this.el)).hide();
- };
-
- OperationView.prototype.toggleOperationContent = function() {
- var elem;
- elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.httpMethod + "_content");
- if (elem.is(':visible')) {
- return Docs.collapseOperation(elem);
- } else {
- return Docs.expandOperation(elem);
- }
- };
-
- return OperationView;
-
- })(Backbone.View);
-
- ParameterView = (function(_super) {
-
- __extends(ParameterView, _super);
-
- function ParameterView() {
- return ParameterView.__super__.constructor.apply(this, arguments);
- }
-
- ParameterView.prototype.initialize = function() {};
-
- ParameterView.prototype.render = function() {
- var template;
- if (this.model.paramType === 'body') {
- this.model.isBody = true;
- }
- template = this.template();
- $(this.el).html(template(this.model));
- 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);
-
-}).call(this);