swaggard 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +178 -0
  4. data/Rakefile +24 -0
  5. data/app/assets/fonts/swaggard/droid-sans-v6-latin-700.eot +0 -0
  6. data/app/assets/fonts/swaggard/droid-sans-v6-latin-700.svg +411 -0
  7. data/app/assets/fonts/swaggard/droid-sans-v6-latin-700.ttf +0 -0
  8. data/app/assets/fonts/swaggard/droid-sans-v6-latin-700.woff +0 -0
  9. data/app/assets/fonts/swaggard/droid-sans-v6-latin-700.woff2 +0 -0
  10. data/app/assets/fonts/swaggard/droid-sans-v6-latin-regular.eot +0 -0
  11. data/app/assets/fonts/swaggard/droid-sans-v6-latin-regular.svg +403 -0
  12. data/app/assets/fonts/swaggard/droid-sans-v6-latin-regular.ttf +0 -0
  13. data/app/assets/fonts/swaggard/droid-sans-v6-latin-regular.woff +0 -0
  14. data/app/assets/fonts/swaggard/droid-sans-v6-latin-regular.woff2 +0 -0
  15. data/app/assets/images/swaggard/logo_small.png +0 -0
  16. data/app/assets/images/swaggard/pet_store_api.png +0 -0
  17. data/app/assets/images/swaggard/throbber.gif +0 -0
  18. data/app/assets/images/swaggard/wordnik_api.png +0 -0
  19. data/app/assets/javascripts/swaggard/application.js +24 -0
  20. data/app/assets/javascripts/swaggard/lib/MD5.js +319 -0
  21. data/app/assets/javascripts/swaggard/lib/backbone-min.js +15 -0
  22. data/app/assets/javascripts/swaggard/lib/handlebars-1.0.rc.1.js +1920 -0
  23. data/app/assets/javascripts/swaggard/lib/handlebars-2.0.0.js +28 -0
  24. data/app/assets/javascripts/swaggard/lib/highlight.7.3.pack.js +1 -0
  25. data/app/assets/javascripts/swaggard/lib/jquery-1.8.0.min.js +2 -0
  26. data/app/assets/javascripts/swaggard/lib/jquery.ba-bbq.min.js +18 -0
  27. data/app/assets/javascripts/swaggard/lib/jquery.slideto.min.js +1 -0
  28. data/app/assets/javascripts/swaggard/lib/jquery.wiggle.min.js +8 -0
  29. data/app/assets/javascripts/swaggard/lib/marked.js +1272 -0
  30. data/app/assets/javascripts/swaggard/lib/shred.bundle.js +2765 -0
  31. data/app/assets/javascripts/swaggard/lib/swagger-client.js +3294 -0
  32. data/app/assets/javascripts/swaggard/lib/swagger.js +794 -0
  33. data/app/assets/javascripts/swaggard/lib/underscore-min.js +32 -0
  34. data/app/assets/javascripts/swaggard/swagger-ui.js +2240 -0
  35. data/app/assets/javascripts/swaggard/swagger-ui_org.js +2005 -0
  36. data/app/assets/stylesheets/swaggard/application.css +16 -0
  37. data/app/assets/stylesheets/swaggard/reset.css +125 -0
  38. data/app/assets/stylesheets/swaggard/screen.css.scss +1256 -0
  39. data/app/assets/stylesheets/swaggard/typography.css.scss +26 -0
  40. data/app/controllers/swaggard/application_controller.rb +4 -0
  41. data/app/controllers/swaggard/swagger_controller.rb +21 -0
  42. data/app/views/swaggard/swagger/index.html.erb +74 -0
  43. data/config/routes.rb +3 -0
  44. data/lib/swaggard.rb +92 -0
  45. data/lib/swaggard/api_definition.rb +52 -0
  46. data/lib/swaggard/configuration.rb +82 -0
  47. data/lib/swaggard/engine.rb +18 -0
  48. data/lib/swaggard/parsers/controllers.rb +30 -0
  49. data/lib/swaggard/parsers/models.rb +29 -0
  50. data/lib/swaggard/parsers/routes.rb +54 -0
  51. data/lib/swaggard/swagger/definition.rb +24 -0
  52. data/lib/swaggard/swagger/operation.rb +98 -0
  53. data/lib/swaggard/swagger/parameters/base.rb +21 -0
  54. data/lib/swaggard/swagger/parameters/body.rb +67 -0
  55. data/lib/swaggard/swagger/parameters/form.rb +32 -0
  56. data/lib/swaggard/swagger/parameters/list.rb +46 -0
  57. data/lib/swaggard/swagger/parameters/path.rb +21 -0
  58. data/lib/swaggard/swagger/parameters/query.rb +32 -0
  59. data/lib/swaggard/swagger/path.rb +24 -0
  60. data/lib/swaggard/swagger/property.rb +23 -0
  61. data/lib/swaggard/swagger/response.rb +45 -0
  62. data/lib/swaggard/swagger/tag.rb +28 -0
  63. data/lib/swaggard/swagger/type.rb +72 -0
  64. data/lib/swaggard/version.rb +5 -0
  65. data/spec/fixtures/api.json +1 -0
  66. data/spec/fixtures/dummy/app/controllers/application_controller.rb +2 -0
  67. data/spec/fixtures/dummy/app/controllers/pets_controller.rb +15 -0
  68. data/spec/fixtures/dummy/config/application.rb +15 -0
  69. data/spec/fixtures/dummy/config/environments/development.rb +5 -0
  70. data/spec/fixtures/dummy/config/routes.rb +5 -0
  71. data/spec/fixtures/dummy/log/development.log +0 -0
  72. data/spec/integration/swaggard_spec.rb +19 -0
  73. data/spec/spec_helper.rb +27 -0
  74. metadata +210 -0
@@ -0,0 +1,32 @@
1
+ // Underscore.js 1.3.3
2
+ // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3
+ // Underscore is freely distributable under the MIT license.
4
+ // Portions of Underscore are inspired or borrowed from Prototype,
5
+ // Oliver Steele's Functional, and John Resig's Micro-Templating.
6
+ // For all details and documentation:
7
+ // http://documentcloud.github.com/underscore
8
+ (function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9
+ c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break;
10
+ g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a,
11
+ c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===o)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===o)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(z&&a.map===z)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(A&&
12
+ a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,
13
+ c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,
14
+ a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15
+ function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&
16
+ (e={value:a,computed:b})});return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){d=Math.floor(Math.random()*(f+1));b[f]=b[d];b[d]=a});return b};b.sortBy=function(a,c,d){var e=b.isFunction(c)?c:function(a){return a[c]};return b.pluck(b.map(a,function(a,b,c){return{value:a,criteria:e.call(d,a,b,c)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c===void 0?1:d===void 0?-1:c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};
17
+ j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?i.call(a):a.toArray&&b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};b.first=b.head=b.take=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,
18
+ 0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,
19
+ e=[];a.length<3&&(c=true);b.reduce(d,function(d,g,h){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[h])}return d},[]);return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=
20
+ i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(q&&a.indexOf===q)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(F&&a.lastIndexOf===F)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){if(arguments.length<=
21
+ 1){b=a||0;a=0}for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+d}return g};var H=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));H.prototype=a.prototype;var b=new H,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=
22
+ i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i,j=b.debounce(function(){h=
23
+ g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);j()},c));g?h=true:i=a.apply(d,e);j();g=true;return i}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments;d&&!e&&a.apply(f,g);clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));
24
+ return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&
25
+ c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=
26
+ function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"};
27
+ b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,
28
+ b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId=
29
+ function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape||
30
+ u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};
31
+ b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d,
32
+ this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
@@ -0,0 +1,2240 @@
1
+ /**
2
+ * swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
3
+ * @version v2.1.8-M1
4
+ * @link http://swagger.io
5
+ * @license Apache 2.0
6
+ */
7
+ $(function() {
8
+
9
+ // Helper function for vertically aligning DOM elements
10
+ // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
11
+ $.fn.vAlign = function() {
12
+ return this.each(function(i){
13
+ var ah = $(this).height();
14
+ var ph = $(this).parent().height();
15
+ var mh = (ph - ah) / 2;
16
+ $(this).css('margin-top', mh);
17
+ });
18
+ };
19
+
20
+ $.fn.stretchFormtasticInputWidthToParent = function() {
21
+ return this.each(function(i){
22
+ var p_width = $(this).closest("form").innerWidth();
23
+ var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
24
+ var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
25
+ $(this).css('width', p_width - p_padding - this_padding);
26
+ });
27
+ };
28
+
29
+ $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
30
+
31
+ // Vertically center these paragraphs
32
+ // Parent may need a min-height for this to work..
33
+ $('ul.downplayed li div.content p').vAlign();
34
+
35
+ // When a sandbox form is submitted..
36
+ $("form.sandbox").submit(function(){
37
+
38
+ var error_free = true;
39
+
40
+ // Cycle through the forms required inputs
41
+ $(this).find("input.required").each(function() {
42
+
43
+ // Remove any existing error styles from the input
44
+ $(this).removeClass('error');
45
+
46
+ // Tack the error style on if the input is empty..
47
+ if ($(this).val() == '') {
48
+ $(this).addClass('error');
49
+ $(this).wiggle();
50
+ error_free = false;
51
+ }
52
+
53
+ });
54
+
55
+ return error_free;
56
+ });
57
+
58
+ });
59
+
60
+ function clippyCopiedCallback(a) {
61
+ $('#api_key_copied').fadeIn().delay(1000).fadeOut();
62
+
63
+ // var b = $("#clippy_tooltip_" + a);
64
+ // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
65
+ // b.attr("title", "copy to clipboard")
66
+ // },
67
+ // 500))
68
+ }
69
+
70
+ // Logging function that accounts for browsers that don't have window.console
71
+ log = function(){
72
+ log.history = log.history || [];
73
+ log.history.push(arguments);
74
+ if(this.console){
75
+ console.log( Array.prototype.slice.call(arguments)[0] );
76
+ }
77
+ };
78
+
79
+ // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
80
+ if (Function.prototype.bind && console && typeof console.log == "object") {
81
+ [
82
+ "log","info","warn","error","assert","dir","clear","profile","profileEnd"
83
+ ].forEach(function (method) {
84
+ console[method] = this.bind(console[method], console);
85
+ }, Function.prototype.call);
86
+ }
87
+
88
+ var Docs = {
89
+
90
+ shebang: function() {
91
+
92
+ // If shebang has an operation nickname in it..
93
+ // e.g. /docs/#!/words/get_search
94
+ var fragments = $.param.fragment().split('/');
95
+ fragments.shift(); // get rid of the bang
96
+
97
+ switch (fragments.length) {
98
+ case 1:
99
+ // Expand all operations for the resource and scroll to it
100
+ var dom_id = 'resource_' + fragments[0];
101
+
102
+ Docs.expandEndpointListForResource(fragments[0]);
103
+ $("#"+dom_id).slideto({highlight: false});
104
+ break;
105
+ case 2:
106
+ // Refer to the endpoint DOM element, e.g. #words_get_search
107
+
108
+ // Expand Resource
109
+ Docs.expandEndpointListForResource(fragments[0]);
110
+ $("#"+dom_id).slideto({highlight: false});
111
+
112
+ // Expand operation
113
+ var li_dom_id = fragments.join('_');
114
+ var li_content_dom_id = li_dom_id + "_content";
115
+
116
+
117
+ Docs.expandOperation($('#'+li_content_dom_id));
118
+ $('#'+li_dom_id).slideto({highlight: false});
119
+ break;
120
+ }
121
+
122
+ },
123
+
124
+ toggleEndpointListForResource: function(resource) {
125
+ var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
126
+ if (elem.is(':visible')) {
127
+ Docs.collapseEndpointListForResource(resource);
128
+ } else {
129
+ Docs.expandEndpointListForResource(resource);
130
+ }
131
+ },
132
+
133
+ // Expand resource
134
+ expandEndpointListForResource: function(resource) {
135
+ var resource = Docs.escapeResourceName(resource);
136
+ if (resource == '') {
137
+ $('.resource ul.endpoints').slideDown();
138
+ return;
139
+ }
140
+
141
+ $('li#resource_' + resource).addClass('active');
142
+
143
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
144
+ elem.slideDown();
145
+ },
146
+
147
+ // Collapse resource and mark as explicitly closed
148
+ collapseEndpointListForResource: function(resource) {
149
+ var resource = Docs.escapeResourceName(resource);
150
+ if (resource == '') {
151
+ $('.resource ul.endpoints').slideUp();
152
+ return;
153
+ }
154
+
155
+ $('li#resource_' + resource).removeClass('active');
156
+
157
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
158
+ elem.slideUp();
159
+ },
160
+
161
+ expandOperationsForResource: function(resource) {
162
+ // Make sure the resource container is open..
163
+ Docs.expandEndpointListForResource(resource);
164
+
165
+ if (resource == '') {
166
+ $('.resource ul.endpoints li.operation div.content').slideDown();
167
+ return;
168
+ }
169
+
170
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
171
+ Docs.expandOperation($(this));
172
+ });
173
+ },
174
+
175
+ collapseOperationsForResource: function(resource) {
176
+ // Make sure the resource container is open..
177
+ Docs.expandEndpointListForResource(resource);
178
+
179
+ if (resource == '') {
180
+ $('.resource ul.endpoints li.operation div.content').slideUp();
181
+ return;
182
+ }
183
+
184
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
185
+ Docs.collapseOperation($(this));
186
+ });
187
+ },
188
+
189
+ escapeResourceName: function(resource) {
190
+ return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
191
+ },
192
+
193
+ expandOperation: function(elem) {
194
+ elem.slideDown();
195
+ },
196
+
197
+ collapseOperation: function(elem) {
198
+ elem.slideUp();
199
+ }
200
+ };
201
+
202
+ this["Handlebars"] = this["Handlebars"] || {};
203
+ this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
204
+ this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
205
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
206
+ return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"
207
+ + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
208
+ + "</div>\n <input placeholder=\"api_key\" class=\"auth_input\" id=\"input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_api_key\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
209
+ },"useData":true});
210
+ var SwaggerUi,
211
+ __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; },
212
+ __hasProp = {}.hasOwnProperty;
213
+
214
+ SwaggerUi = (function(_super) {
215
+ __extends(SwaggerUi, _super);
216
+
217
+ function SwaggerUi() {
218
+ return SwaggerUi.__super__.constructor.apply(this, arguments);
219
+ }
220
+
221
+ SwaggerUi.prototype.dom_id = "swagger_ui";
222
+
223
+ SwaggerUi.prototype.options = null;
224
+
225
+ SwaggerUi.prototype.api = null;
226
+
227
+ SwaggerUi.prototype.headerView = null;
228
+
229
+ SwaggerUi.prototype.mainView = null;
230
+
231
+ SwaggerUi.prototype.initialize = function(options) {
232
+ if (options == null) {
233
+ options = {};
234
+ }
235
+ if (options.dom_id != null) {
236
+ this.dom_id = options.dom_id;
237
+ delete options.dom_id;
238
+ }
239
+ if (options.supportedSubmitMethods == null) {
240
+ options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
241
+ }
242
+ if ($('#' + this.dom_id) == null) {
243
+ $('body').append('<div id="' + this.dom_id + '"></div>');
244
+ }
245
+ this.options = options;
246
+ this.options.success = (function(_this) {
247
+ return function() {
248
+ return _this.render();
249
+ };
250
+ })(this);
251
+ this.options.progress = (function(_this) {
252
+ return function(d) {
253
+ return _this.showMessage(d);
254
+ };
255
+ })(this);
256
+ this.options.failure = (function(_this) {
257
+ return function(d) {
258
+ return _this.onLoadFailure(d);
259
+ };
260
+ })(this);
261
+ this.headerView = new HeaderView({
262
+ el: $('#header')
263
+ });
264
+ return this.headerView.on('update-swagger-ui', (function(_this) {
265
+ return function(data) {
266
+ return _this.updateSwaggerUi(data);
267
+ };
268
+ })(this));
269
+ };
270
+
271
+ SwaggerUi.prototype.setOption = function(option, value) {
272
+ return this.options[option] = value;
273
+ };
274
+
275
+ SwaggerUi.prototype.getOption = function(option) {
276
+ return this.options[option];
277
+ };
278
+
279
+ SwaggerUi.prototype.updateSwaggerUi = function(data) {
280
+ this.options.url = data.url;
281
+ return this.load();
282
+ };
283
+
284
+ SwaggerUi.prototype.load = function() {
285
+ var url, _ref;
286
+ if ((_ref = this.mainView) != null) {
287
+ _ref.clear();
288
+ }
289
+ url = this.options.url;
290
+ if (url && url.indexOf("http") !== 0) {
291
+ url = this.buildUrl(window.location.href.toString(), url);
292
+ }
293
+ this.options.url = url;
294
+ this.headerView.update(url);
295
+ return this.api = new SwaggerClient(this.options);
296
+ };
297
+
298
+ SwaggerUi.prototype.collapseAll = function() {
299
+ return Docs.collapseEndpointListForResource('');
300
+ };
301
+
302
+ SwaggerUi.prototype.listAll = function() {
303
+ return Docs.collapseOperationsForResource('');
304
+ };
305
+
306
+ SwaggerUi.prototype.expandAll = function() {
307
+ return Docs.expandOperationsForResource('');
308
+ };
309
+
310
+ SwaggerUi.prototype.render = function() {
311
+ this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
312
+ this.mainView = new MainView({
313
+ model: this.api,
314
+ el: $('#' + this.dom_id),
315
+ swaggerOptions: this.options
316
+ }).render();
317
+ this.showMessage();
318
+ switch (this.options.docExpansion) {
319
+ case "full":
320
+ this.expandAll();
321
+ break;
322
+ case "list":
323
+ this.listAll();
324
+ }
325
+ this.renderGFM();
326
+ if (this.options.onComplete) {
327
+ this.options.onComplete(this.api, this);
328
+ }
329
+ return setTimeout((function(_this) {
330
+ return function() {
331
+ return Docs.shebang();
332
+ };
333
+ })(this), 100);
334
+ };
335
+
336
+ SwaggerUi.prototype.buildUrl = function(base, url) {
337
+ var endOfPath, parts;
338
+ if (url.indexOf("/") === 0) {
339
+ parts = base.split("/");
340
+ base = parts[0] + "//" + parts[2];
341
+ return base + url;
342
+ } else {
343
+ endOfPath = base.length;
344
+ if (base.indexOf("?") > -1) {
345
+ endOfPath = Math.min(endOfPath, base.indexOf("?"));
346
+ }
347
+ if (base.indexOf("#") > -1) {
348
+ endOfPath = Math.min(endOfPath, base.indexOf("#"));
349
+ }
350
+ base = base.substring(0, endOfPath);
351
+ if (base.indexOf("/", base.length - 1) !== -1) {
352
+ return base + url;
353
+ }
354
+ return base + "/" + url;
355
+ }
356
+ };
357
+
358
+ SwaggerUi.prototype.showMessage = function(data) {
359
+ if (data == null) {
360
+ data = '';
361
+ }
362
+ $('#message-bar').removeClass('message-fail');
363
+ $('#message-bar').addClass('message-success');
364
+ return $('#message-bar').html(data);
365
+ };
366
+
367
+ SwaggerUi.prototype.onLoadFailure = function(data) {
368
+ var val;
369
+ if (data == null) {
370
+ data = '';
371
+ }
372
+ $('#message-bar').removeClass('message-success');
373
+ $('#message-bar').addClass('message-fail');
374
+ val = $('#message-bar').html(data);
375
+ if (this.options.onFailure != null) {
376
+ this.options.onFailure(data);
377
+ }
378
+ return val;
379
+ };
380
+
381
+ SwaggerUi.prototype.renderGFM = function(data) {
382
+ if (data == null) {
383
+ data = '';
384
+ }
385
+ return $('.markdown').each(function(index) {
386
+ return $(this).html(marked($(this).html()));
387
+ });
388
+ };
389
+
390
+ return SwaggerUi;
391
+
392
+ })(Backbone.Router);
393
+
394
+ window.SwaggerUi = SwaggerUi;
395
+
396
+ this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
397
+ return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">Username</div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\">Password</div>\n <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
398
+ },"useData":true});
399
+ Handlebars.registerHelper('sanitize', function(html) {
400
+ html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
401
+ return new Handlebars.SafeString(html);
402
+ });
403
+
404
+ this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
405
+ var stack1, buffer = "";
406
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
407
+ if (stack1 != null) { buffer += stack1; }
408
+ return buffer;
409
+ },"2":function(depth0,helpers,partials,data) {
410
+ var stack1, lambda=this.lambda, buffer = " <option value=\"";
411
+ stack1 = lambda(depth0, depth0);
412
+ if (stack1 != null) { buffer += stack1; }
413
+ buffer += "\">";
414
+ stack1 = lambda(depth0, depth0);
415
+ if (stack1 != null) { buffer += stack1; }
416
+ return buffer + "</option>\n";
417
+ },"4":function(depth0,helpers,partials,data) {
418
+ return " <option value=\"application/json\">application/json</option>\n";
419
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
420
+ var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
421
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
422
+ if (stack1 != null) { buffer += stack1; }
423
+ return buffer + "</select>\n";
424
+ },"useData":true});
425
+ var ApiKeyButton,
426
+ __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; },
427
+ __hasProp = {}.hasOwnProperty;
428
+
429
+ ApiKeyButton = (function(_super) {
430
+ __extends(ApiKeyButton, _super);
431
+
432
+ function ApiKeyButton() {
433
+ return ApiKeyButton.__super__.constructor.apply(this, arguments);
434
+ }
435
+
436
+ ApiKeyButton.prototype.initialize = function() {};
437
+
438
+ ApiKeyButton.prototype.render = function() {
439
+ var template;
440
+ template = this.template();
441
+ $(this.el).html(template(this.model));
442
+ return this;
443
+ };
444
+
445
+ ApiKeyButton.prototype.events = {
446
+ "click #apikey_button": "toggleApiKeyContainer",
447
+ "click #apply_api_key": "applyApiKey"
448
+ };
449
+
450
+ ApiKeyButton.prototype.applyApiKey = function() {
451
+ var elem;
452
+ window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
453
+ window.swaggerUi.load();
454
+ return elem = $('#apikey_container').show();
455
+ };
456
+
457
+ ApiKeyButton.prototype.toggleApiKeyContainer = function() {
458
+ var elem;
459
+ if ($('#apikey_container').length > 0) {
460
+ elem = $('#apikey_container').first();
461
+ if (elem.is(':visible')) {
462
+ return elem.hide();
463
+ } else {
464
+ $('.auth_container').hide();
465
+ return elem.show();
466
+ }
467
+ }
468
+ };
469
+
470
+ ApiKeyButton.prototype.template = function() {
471
+ return Handlebars.templates.apikey_button_view;
472
+ };
473
+
474
+ return ApiKeyButton;
475
+
476
+ })(Backbone.View);
477
+
478
+ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
479
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
480
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
481
+ + "</div>\n <div class=\"info_description markdown\">";
482
+ stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
483
+ if (stack1 != null) { buffer += stack1; }
484
+ buffer += "</div>\n ";
485
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
486
+ if (stack1 != null) { buffer += stack1; }
487
+ buffer += "\n ";
488
+ stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
489
+ if (stack1 != null) { buffer += stack1; }
490
+ buffer += "\n ";
491
+ stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
492
+ if (stack1 != null) { buffer += stack1; }
493
+ buffer += "\n ";
494
+ stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
495
+ if (stack1 != null) { buffer += stack1; }
496
+ buffer += "\n ";
497
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
498
+ if (stack1 != null) { buffer += stack1; }
499
+ return buffer + "\n";
500
+ },"2":function(depth0,helpers,partials,data) {
501
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
502
+ return "<div class=\"info_tos\"><a href=\""
503
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
504
+ + "\">Terms of service</a></div>";
505
+ },"4":function(depth0,helpers,partials,data) {
506
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
507
+ return "<div class='info_name'>Created by "
508
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
509
+ + "</div>";
510
+ },"6":function(depth0,helpers,partials,data) {
511
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
512
+ return "<div class='info_url'>See more at <a href=\""
513
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
514
+ + "\">"
515
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
516
+ + "</a></div>";
517
+ },"8":function(depth0,helpers,partials,data) {
518
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
519
+ return "<div class='info_email'><a href=\"mailto:"
520
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
521
+ + "?subject="
522
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
523
+ + "\">Contact the developer</a></div>";
524
+ },"10":function(depth0,helpers,partials,data) {
525
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
526
+ return "<div class='info_license'><a href='"
527
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
528
+ + "'>"
529
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
530
+ + "</a></div>";
531
+ },"12":function(depth0,helpers,partials,data) {
532
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
533
+ return " , <span style=\"font-variant: small-caps\">api version</span>: "
534
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
535
+ + "\n ";
536
+ },"14":function(depth0,helpers,partials,data) {
537
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
538
+ return " <span style=\"float:right\"><a href=\""
539
+ + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
540
+ + "/debug?url="
541
+ + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
542
+ + "\"><img id=\"validator\" src=\""
543
+ + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
544
+ + "?url="
545
+ + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
546
+ + "\"></a>\n </span>\n";
547
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
548
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
549
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
550
+ if (stack1 != null) { buffer += stack1; }
551
+ buffer += "</div>\n<div class='container' id='resources_container'>\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
552
+ + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
553
+ + "\n";
554
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
555
+ if (stack1 != null) { buffer += stack1; }
556
+ buffer += "]\n";
557
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
558
+ if (stack1 != null) { buffer += stack1; }
559
+ return buffer + " </h4>\n </div>\n</div>\n";
560
+ },"useData":true});
561
+ var BasicAuthButton,
562
+ __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; },
563
+ __hasProp = {}.hasOwnProperty;
564
+
565
+ BasicAuthButton = (function(_super) {
566
+ __extends(BasicAuthButton, _super);
567
+
568
+ function BasicAuthButton() {
569
+ return BasicAuthButton.__super__.constructor.apply(this, arguments);
570
+ }
571
+
572
+ BasicAuthButton.prototype.initialize = function() {};
573
+
574
+ BasicAuthButton.prototype.render = function() {
575
+ var template;
576
+ template = this.template();
577
+ $(this.el).html(template(this.model));
578
+ return this;
579
+ };
580
+
581
+ BasicAuthButton.prototype.events = {
582
+ "click #basic_auth_button": "togglePasswordContainer",
583
+ "click #apply_basic_auth": "applyPassword"
584
+ };
585
+
586
+ BasicAuthButton.prototype.applyPassword = function() {
587
+ var elem, password, username;
588
+ username = $(".input_username").val();
589
+ password = $(".input_password").val();
590
+ window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
591
+ window.swaggerUi.load();
592
+ return elem = $('#basic_auth_container').hide();
593
+ };
594
+
595
+ BasicAuthButton.prototype.togglePasswordContainer = function() {
596
+ var elem;
597
+ if ($('#basic_auth_container').length > 0) {
598
+ elem = $('#basic_auth_container').show();
599
+ if (elem.is(':visible')) {
600
+ return elem.slideUp();
601
+ } else {
602
+ $('.auth_container').hide();
603
+ return elem.show();
604
+ }
605
+ }
606
+ };
607
+
608
+ BasicAuthButton.prototype.template = function() {
609
+ return Handlebars.templates.basic_auth_button_view;
610
+ };
611
+
612
+ return BasicAuthButton;
613
+
614
+ })(Backbone.View);
615
+
616
+ this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
617
+ return "deprecated";
618
+ },"3":function(depth0,helpers,partials,data) {
619
+ return " <h4>Warning: Deprecated</h4>\n";
620
+ },"5":function(depth0,helpers,partials,data) {
621
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
622
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
623
+ if (stack1 != null) { buffer += stack1; }
624
+ return buffer + "</p>\n";
625
+ },"7":function(depth0,helpers,partials,data) {
626
+ return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
627
+ },"9":function(depth0,helpers,partials,data) {
628
+ var stack1, buffer = " <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
629
+ stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
630
+ if (stack1 != null) { buffer += stack1; }
631
+ return buffer + " </div>\n";
632
+ },"10":function(depth0,helpers,partials,data) {
633
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
634
+ stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
635
+ if (stack1 != null) { buffer += stack1; }
636
+ return buffer + "'>"
637
+ + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
638
+ + "</div>\n";
639
+ },"12":function(depth0,helpers,partials,data) {
640
+ return "</div>";
641
+ },"14":function(depth0,helpers,partials,data) {
642
+ return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
643
+ },"16":function(depth0,helpers,partials,data) {
644
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
645
+ return " <h4>Response Class (Status "
646
+ + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
647
+ + ")</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n";
648
+ },"18":function(depth0,helpers,partials,data) {
649
+ return " <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: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n";
650
+ },"20":function(depth0,helpers,partials,data) {
651
+ return " <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n";
652
+ },"22":function(depth0,helpers,partials,data) {
653
+ return "";
654
+ },"24":function(depth0,helpers,partials,data) {
655
+ return " <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";
656
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
657
+ var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
658
+ + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
659
+ + " operation' id='"
660
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
661
+ + "_"
662
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
663
+ + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"
664
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
665
+ + "/"
666
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
667
+ + "' class=\"toggleOperation\">"
668
+ + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
669
+ + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
670
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
671
+ + "/"
672
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
673
+ + "' class=\"toggleOperation ";
674
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
675
+ if (stack1 != null) { buffer += stack1; }
676
+ buffer += "\">"
677
+ + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
678
+ + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
679
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
680
+ + "/"
681
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
682
+ + "' class=\"toggleOperation\">";
683
+ stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
684
+ if (stack1 != null) { buffer += stack1; }
685
+ buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
686
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
687
+ + "_"
688
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
689
+ + "_content' style='display:none'>\n";
690
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
691
+ if (stack1 != null) { buffer += stack1; }
692
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
693
+ if (stack1 != null) { buffer += stack1; }
694
+ stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
695
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
696
+ if (stack1 != null) { buffer += stack1; }
697
+ buffer += "\n";
698
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
699
+ if (stack1 != null) { buffer += stack1; }
700
+ buffer += " ";
701
+ stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
702
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
703
+ if (stack1 != null) { buffer += stack1; }
704
+ buffer += "\n";
705
+ stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
706
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
707
+ if (stack1 != null) { buffer += stack1; }
708
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
709
+ if (stack1 != null) { buffer += stack1; }
710
+ buffer += " <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
711
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
712
+ if (stack1 != null) { buffer += stack1; }
713
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
714
+ if (stack1 != null) { buffer += stack1; }
715
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
716
+ if (stack1 != null) { buffer += stack1; }
717
+ return buffer + " </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";
718
+ },"useData":true});
719
+ var ContentTypeView,
720
+ __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; },
721
+ __hasProp = {}.hasOwnProperty;
722
+
723
+ ContentTypeView = (function(_super) {
724
+ __extends(ContentTypeView, _super);
725
+
726
+ function ContentTypeView() {
727
+ return ContentTypeView.__super__.constructor.apply(this, arguments);
728
+ }
729
+
730
+ ContentTypeView.prototype.initialize = function() {};
731
+
732
+ ContentTypeView.prototype.render = function() {
733
+ var template;
734
+ template = this.template();
735
+ $(this.el).html(template(this.model));
736
+ $('label[for=contentType]', $(this.el)).text('Response Content Type');
737
+ return this;
738
+ };
739
+
740
+ ContentTypeView.prototype.template = function() {
741
+ return Handlebars.templates.content_type;
742
+ };
743
+
744
+ return ContentTypeView;
745
+
746
+ })(Backbone.View);
747
+
748
+ this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
749
+ var stack1, buffer = "";
750
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
751
+ if (stack1 != null) { buffer += stack1; }
752
+ return buffer;
753
+ },"2":function(depth0,helpers,partials,data) {
754
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
755
+ return " <input type=\"file\" name='"
756
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
757
+ + "'/>\n <div class=\"parameter-content-type\" />\n";
758
+ },"4":function(depth0,helpers,partials,data) {
759
+ var stack1, buffer = "";
760
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
761
+ if (stack1 != null) { buffer += stack1; }
762
+ return buffer;
763
+ },"5":function(depth0,helpers,partials,data) {
764
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
765
+ return " <textarea class='body-textarea' name='"
766
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
767
+ + "'>"
768
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
769
+ + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
770
+ },"7":function(depth0,helpers,partials,data) {
771
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
772
+ return " <textarea class='body-textarea' name='"
773
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
774
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
775
+ },"9":function(depth0,helpers,partials,data) {
776
+ var stack1, buffer = "";
777
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
778
+ if (stack1 != null) { buffer += stack1; }
779
+ return buffer;
780
+ },"10":function(depth0,helpers,partials,data) {
781
+ var stack1, buffer = "";
782
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
783
+ if (stack1 != null) { buffer += stack1; }
784
+ return buffer;
785
+ },"11":function(depth0,helpers,partials,data) {
786
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
787
+ return " <input class='parameter' minlength='0' name='"
788
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
789
+ + "' placeholder='' type='text' value='"
790
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
791
+ + "'/>\n";
792
+ },"13":function(depth0,helpers,partials,data) {
793
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
794
+ return " <input class='parameter' minlength='0' name='"
795
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
796
+ + "' placeholder='' type='text' value=''/>\n";
797
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
798
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
799
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
800
+ + "</td>\n<td>\n\n";
801
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
802
+ if (stack1 != null) { buffer += stack1; }
803
+ buffer += "\n</td>\n<td class=\"markdown\">";
804
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
805
+ if (stack1 != null) { buffer += stack1; }
806
+ buffer += "</td>\n<td>";
807
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
808
+ if (stack1 != null) { buffer += stack1; }
809
+ return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
810
+ },"useData":true});
811
+ var HeaderView,
812
+ __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; },
813
+ __hasProp = {}.hasOwnProperty;
814
+
815
+ HeaderView = (function(_super) {
816
+ __extends(HeaderView, _super);
817
+
818
+ function HeaderView() {
819
+ return HeaderView.__super__.constructor.apply(this, arguments);
820
+ }
821
+
822
+ HeaderView.prototype.events = {
823
+ 'click #show-pet-store-icon': 'showPetStore',
824
+ 'click #show-wordnik-dev-icon': 'showWordnikDev',
825
+ 'click #explore': 'showCustom',
826
+ 'keyup #input_baseUrl': 'showCustomOnKeyup',
827
+ 'keyup #input_apiKey': 'showCustomOnKeyup'
828
+ };
829
+
830
+ HeaderView.prototype.initialize = function() {};
831
+
832
+ HeaderView.prototype.showPetStore = function(e) {
833
+ return this.trigger('update-swagger-ui', {
834
+ url: "http://petstore.swagger.wordnik.com/api/api-docs"
835
+ });
836
+ };
837
+
838
+ HeaderView.prototype.showWordnikDev = function(e) {
839
+ return this.trigger('update-swagger-ui', {
840
+ url: "http://api.wordnik.com/v4/resources.json"
841
+ });
842
+ };
843
+
844
+ HeaderView.prototype.showCustomOnKeyup = function(e) {
845
+ if (e.keyCode === 13) {
846
+ return this.showCustom();
847
+ }
848
+ };
849
+
850
+ HeaderView.prototype.showCustom = function(e) {
851
+ if (e != null) {
852
+ e.preventDefault();
853
+ }
854
+ return this.trigger('update-swagger-ui', {
855
+ url: $('#input_baseUrl').val(),
856
+ apiKey: $('#input_apiKey').val()
857
+ });
858
+ };
859
+
860
+ HeaderView.prototype.update = function(url, apiKey, trigger) {
861
+ if (trigger == null) {
862
+ trigger = false;
863
+ }
864
+ $('#input_baseUrl').val(url);
865
+ if (trigger) {
866
+ return this.trigger('update-swagger-ui', {
867
+ url: url
868
+ });
869
+ }
870
+ };
871
+
872
+ return HeaderView;
873
+
874
+ })(Backbone.View);
875
+
876
+ this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
877
+ return " multiple='multiple'";
878
+ },"3":function(depth0,helpers,partials,data) {
879
+ return "";
880
+ },"5":function(depth0,helpers,partials,data) {
881
+ var stack1, buffer = "";
882
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
883
+ if (stack1 != null) { buffer += stack1; }
884
+ return buffer;
885
+ },"6":function(depth0,helpers,partials,data) {
886
+ var stack1, helperMissing=helpers.helperMissing, buffer = "";
887
+ stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
888
+ if (stack1 != null) { buffer += stack1; }
889
+ return buffer;
890
+ },"7":function(depth0,helpers,partials,data) {
891
+ return " <option selected=\"\" value=''></option>\n";
892
+ },"9":function(depth0,helpers,partials,data) {
893
+ var stack1, buffer = "";
894
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
895
+ if (stack1 != null) { buffer += stack1; }
896
+ return buffer;
897
+ },"10":function(depth0,helpers,partials,data) {
898
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
899
+ return " <option selected=\"\" value='"
900
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
901
+ + "'>"
902
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
903
+ + " (default)</option>\n";
904
+ },"12":function(depth0,helpers,partials,data) {
905
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
906
+ return " <option value='"
907
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
908
+ + "'>"
909
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
910
+ + "</option>\n";
911
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
912
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
913
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
914
+ + "</td>\n<td>\n <select ";
915
+ stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
916
+ if (stack1 != null) { buffer += stack1; }
917
+ buffer += " class='parameter' name='"
918
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
919
+ + "'>\n";
920
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
921
+ if (stack1 != null) { buffer += stack1; }
922
+ stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
923
+ if (stack1 != null) { buffer += stack1; }
924
+ buffer += " </select>\n</td>\n<td class=\"markdown\">";
925
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
926
+ if (stack1 != null) { buffer += stack1; }
927
+ buffer += "</td>\n<td>";
928
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
929
+ if (stack1 != null) { buffer += stack1; }
930
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
931
+ },"useData":true});
932
+ var MainView,
933
+ __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; },
934
+ __hasProp = {}.hasOwnProperty;
935
+
936
+ MainView = (function(_super) {
937
+ var sorters;
938
+
939
+ __extends(MainView, _super);
940
+
941
+ function MainView() {
942
+ return MainView.__super__.constructor.apply(this, arguments);
943
+ }
944
+
945
+ sorters = {
946
+ 'alpha': function(a, b) {
947
+ return a.path.localeCompare(b.path);
948
+ },
949
+ 'method': function(a, b) {
950
+ return a.method.localeCompare(b.method);
951
+ }
952
+ };
953
+
954
+ MainView.prototype.initialize = function(opts) {
955
+ var auth, key, value, _ref;
956
+ if (opts == null) {
957
+ opts = {};
958
+ }
959
+ this.model.auths = [];
960
+ _ref = this.model.securityDefinitions;
961
+ for (key in _ref) {
962
+ value = _ref[key];
963
+ auth = {
964
+ name: key,
965
+ type: value.type,
966
+ value: value
967
+ };
968
+ this.model.auths.push(auth);
969
+ }
970
+ if (this.model.swaggerVersion === "2.0") {
971
+ if ("validatorUrl" in opts.swaggerOptions) {
972
+ return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
973
+ } else if (this.model.url.indexOf("localhost") > 0) {
974
+ return this.model.validatorUrl = null;
975
+ } else {
976
+ return this.model.validatorUrl = "http://online.swagger.io/validator";
977
+ }
978
+ }
979
+ };
980
+
981
+ MainView.prototype.render = function() {
982
+ var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
983
+ if (this.model.securityDefinitions) {
984
+ for (name in this.model.securityDefinitions) {
985
+ auth = this.model.securityDefinitions[name];
986
+ if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
987
+ button = new ApiKeyButton({
988
+ model: auth
989
+ }).render().el;
990
+ $('.auth_main_container').append(button);
991
+ }
992
+ if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
993
+ button = new BasicAuthButton({
994
+ model: auth
995
+ }).render().el;
996
+ $('.auth_main_container').append(button);
997
+ }
998
+ }
999
+ }
1000
+ $(this.el).html(Handlebars.templates.main(this.model));
1001
+ resources = {};
1002
+ counter = 0;
1003
+ _ref = this.model.apisArray;
1004
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1005
+ resource = _ref[_i];
1006
+ id = resource.name;
1007
+ while (typeof resources[id] !== 'undefined') {
1008
+ id = id + "_" + counter;
1009
+ counter += 1;
1010
+ }
1011
+ resource.id = id;
1012
+ resources[id] = resource;
1013
+ this.addResource(resource, this.model.auths);
1014
+ }
1015
+ $('.propWrap').hover(function() {
1016
+ return $('.optionsWrapper', $(this)).show();
1017
+ }, function() {
1018
+ return $('.optionsWrapper', $(this)).hide();
1019
+ });
1020
+ return this;
1021
+ };
1022
+
1023
+ MainView.prototype.addResource = function(resource, auths) {
1024
+ var resourceView;
1025
+ resource.id = resource.id.replace(/\s/g, '_');
1026
+ resourceView = new ResourceView({
1027
+ model: resource,
1028
+ tagName: 'li',
1029
+ id: 'resource_' + resource.id,
1030
+ className: 'resource',
1031
+ auths: auths,
1032
+ swaggerOptions: this.options.swaggerOptions
1033
+ });
1034
+ return $('#resources').append(resourceView.render().el);
1035
+ };
1036
+
1037
+ MainView.prototype.clear = function() {
1038
+ return $(this.el).html('');
1039
+ };
1040
+
1041
+ return MainView;
1042
+
1043
+ })(Backbone.View);
1044
+
1045
+ this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1046
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1047
+ return " <textarea class='body-textarea' readonly='readonly' name='"
1048
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1049
+ + "'>"
1050
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1051
+ + "</textarea>\n";
1052
+ },"3":function(depth0,helpers,partials,data) {
1053
+ var stack1, buffer = "";
1054
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1055
+ if (stack1 != null) { buffer += stack1; }
1056
+ return buffer;
1057
+ },"4":function(depth0,helpers,partials,data) {
1058
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1059
+ return " "
1060
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1061
+ + "\n";
1062
+ },"6":function(depth0,helpers,partials,data) {
1063
+ return " (empty)\n";
1064
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1065
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
1066
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1067
+ + "</td>\n<td>\n";
1068
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1069
+ if (stack1 != null) { buffer += stack1; }
1070
+ buffer += "</td>\n<td class=\"markdown\">";
1071
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1072
+ if (stack1 != null) { buffer += stack1; }
1073
+ buffer += "</td>\n<td>";
1074
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1075
+ if (stack1 != null) { buffer += stack1; }
1076
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1077
+ },"useData":true});
1078
+ this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1079
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1080
+ return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
1081
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1082
+ + "'>"
1083
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1084
+ + "</textarea>\n";
1085
+ },"3":function(depth0,helpers,partials,data) {
1086
+ var stack1, buffer = "";
1087
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1088
+ if (stack1 != null) { buffer += stack1; }
1089
+ return buffer;
1090
+ },"4":function(depth0,helpers,partials,data) {
1091
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1092
+ return " "
1093
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1094
+ + "\n";
1095
+ },"6":function(depth0,helpers,partials,data) {
1096
+ return " (empty)\n";
1097
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1098
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1099
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1100
+ + "</td>\n<td>\n";
1101
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1102
+ if (stack1 != null) { buffer += stack1; }
1103
+ buffer += "</td>\n<td class=\"markdown\">";
1104
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1105
+ if (stack1 != null) { buffer += stack1; }
1106
+ buffer += "</td>\n<td>";
1107
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1108
+ if (stack1 != null) { buffer += stack1; }
1109
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1110
+ },"useData":true});
1111
+ var OperationView,
1112
+ __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; },
1113
+ __hasProp = {}.hasOwnProperty;
1114
+
1115
+ OperationView = (function(_super) {
1116
+ __extends(OperationView, _super);
1117
+
1118
+ function OperationView() {
1119
+ return OperationView.__super__.constructor.apply(this, arguments);
1120
+ }
1121
+
1122
+ OperationView.prototype.invocationUrl = null;
1123
+
1124
+ OperationView.prototype.events = {
1125
+ 'submit .sandbox': 'submitOperation',
1126
+ 'click .submit': 'submitOperation',
1127
+ 'click .response_hider': 'hideResponse',
1128
+ 'click .toggleOperation': 'toggleOperationContent',
1129
+ 'mouseenter .api-ic': 'mouseEnter',
1130
+ 'mouseout .api-ic': 'mouseExit'
1131
+ };
1132
+
1133
+ OperationView.prototype.initialize = function(opts) {
1134
+ if (opts == null) {
1135
+ opts = {};
1136
+ }
1137
+ this.auths = opts.auths;
1138
+ this.parentId = this.model.parentId;
1139
+ this.nickname = this.model.nickname;
1140
+ return this;
1141
+ };
1142
+
1143
+ OperationView.prototype.mouseEnter = function(e) {
1144
+ var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1145
+ elem = $(this.el).find('.content');
1146
+ x = e.pageX;
1147
+ y = e.pageY;
1148
+ scX = $(window).scrollLeft();
1149
+ scY = $(window).scrollTop();
1150
+ scMaxX = scX + $(window).width();
1151
+ scMaxY = scY + $(window).height();
1152
+ wd = elem.width();
1153
+ hgh = elem.height();
1154
+ if (x + wd > scMaxX) {
1155
+ x = scMaxX - wd;
1156
+ }
1157
+ if (x < scX) {
1158
+ x = scX;
1159
+ }
1160
+ if (y + hgh > scMaxY) {
1161
+ y = scMaxY - hgh;
1162
+ }
1163
+ if (y < scY) {
1164
+ y = scY;
1165
+ }
1166
+ pos = {};
1167
+ pos.top = y;
1168
+ pos.left = x;
1169
+ elem.css(pos);
1170
+ return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1171
+ };
1172
+
1173
+ OperationView.prototype.mouseExit = function(e) {
1174
+ return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1175
+ };
1176
+
1177
+ OperationView.prototype.render = function() {
1178
+ var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, modelAuths, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
1179
+ isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
1180
+ if (!isMethodSubmissionSupported) {
1181
+ this.model.isReadOnly = true;
1182
+ }
1183
+ this.model.description = this.model.description || this.model.notes;
1184
+ if (this.model.description) {
1185
+ this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1186
+ }
1187
+ this.model.oauth = null;
1188
+ modelAuths = this.model.authorizations || this.model.security;
1189
+ if (modelAuths) {
1190
+ if (Array.isArray(modelAuths)) {
1191
+ for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
1192
+ auths = modelAuths[_i];
1193
+ for (key in auths) {
1194
+ auth = auths[key];
1195
+ for (a in this.auths) {
1196
+ auth = this.auths[a];
1197
+ if (auth.type === 'oauth2') {
1198
+ this.model.oauth = {};
1199
+ this.model.oauth.scopes = [];
1200
+ _ref = auth.value.scopes;
1201
+ for (k in _ref) {
1202
+ v = _ref[k];
1203
+ scopeIndex = auths[key].indexOf(k);
1204
+ if (scopeIndex >= 0) {
1205
+ o = {
1206
+ scope: k,
1207
+ description: v
1208
+ };
1209
+ this.model.oauth.scopes.push(o);
1210
+ }
1211
+ }
1212
+ }
1213
+ }
1214
+ }
1215
+ }
1216
+ } else {
1217
+ for (k in modelAuths) {
1218
+ v = modelAuths[k];
1219
+ if (k === "oauth2") {
1220
+ if (this.model.oauth === null) {
1221
+ this.model.oauth = {};
1222
+ }
1223
+ if (this.model.oauth.scopes === void 0) {
1224
+ this.model.oauth.scopes = [];
1225
+ }
1226
+ for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
1227
+ o = v[_j];
1228
+ this.model.oauth.scopes.push(o);
1229
+ }
1230
+ }
1231
+ }
1232
+ }
1233
+ }
1234
+ if (typeof this.model.responses !== 'undefined') {
1235
+ this.model.responseMessages = [];
1236
+ _ref1 = this.model.responses;
1237
+ for (code in _ref1) {
1238
+ value = _ref1[code];
1239
+ schema = null;
1240
+ schemaObj = this.model.responses[code].schema;
1241
+ if (schemaObj && schemaObj['$ref']) {
1242
+ schema = schemaObj['$ref'];
1243
+ if (schema.indexOf('#/definitions/') === 0) {
1244
+ schema = schema.substring('#/definitions/'.length);
1245
+ }
1246
+ }
1247
+ this.model.responseMessages.push({
1248
+ code: code,
1249
+ message: value.description,
1250
+ responseModel: schema
1251
+ });
1252
+ }
1253
+ }
1254
+ if (typeof this.model.responseMessages === 'undefined') {
1255
+ this.model.responseMessages = [];
1256
+ }
1257
+ signatureModel = null;
1258
+ if (this.model.successResponse) {
1259
+ successResponse = this.model.successResponse;
1260
+ for (key in successResponse) {
1261
+ value = successResponse[key];
1262
+ this.model.successCode = key;
1263
+ if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
1264
+ signatureModel = {
1265
+ sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
1266
+ isParam: false,
1267
+ signature: value.getMockSignature()
1268
+ };
1269
+ }
1270
+ }
1271
+ } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1272
+ signatureModel = {
1273
+ sampleJSON: this.model.responseSampleJSON,
1274
+ isParam: false,
1275
+ signature: this.model.responseClassSignature
1276
+ };
1277
+ }
1278
+ $(this.el).html(Handlebars.templates.operation(this.model));
1279
+ if (signatureModel) {
1280
+ responseSignatureView = new SignatureView({
1281
+ model: signatureModel,
1282
+ tagName: 'div'
1283
+ });
1284
+ $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1285
+ } else {
1286
+ this.model.responseClassSignature = 'string';
1287
+ $('.model-signature', $(this.el)).html(this.model.type);
1288
+ }
1289
+ contentTypeModel = {
1290
+ isParam: false
1291
+ };
1292
+ contentTypeModel.consumes = this.model.consumes;
1293
+ contentTypeModel.produces = this.model.produces;
1294
+ _ref2 = this.model.parameters;
1295
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1296
+ param = _ref2[_k];
1297
+ type = param.type || param.dataType || '';
1298
+ if (typeof type === 'undefined') {
1299
+ schema = param.schema;
1300
+ if (schema && schema['$ref']) {
1301
+ ref = schema['$ref'];
1302
+ if (ref.indexOf('#/definitions/') === 0) {
1303
+ type = ref.substring('#/definitions/'.length);
1304
+ } else {
1305
+ type = ref;
1306
+ }
1307
+ }
1308
+ }
1309
+ if (type && type.toLowerCase() === 'file') {
1310
+ if (!contentTypeModel.consumes) {
1311
+ contentTypeModel.consumes = 'multipart/form-data';
1312
+ }
1313
+ }
1314
+ param.type = type;
1315
+ }
1316
+ responseContentTypeView = new ResponseContentTypeView({
1317
+ model: contentTypeModel
1318
+ });
1319
+ $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1320
+ _ref3 = this.model.parameters;
1321
+ for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1322
+ param = _ref3[_l];
1323
+ this.addParameter(param, contentTypeModel.consumes);
1324
+ }
1325
+ _ref4 = this.model.responseMessages;
1326
+ for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1327
+ statusCode = _ref4[_m];
1328
+ this.addStatusCode(statusCode);
1329
+ }
1330
+ return this;
1331
+ };
1332
+
1333
+ OperationView.prototype.addParameter = function(param, consumes) {
1334
+ var paramView;
1335
+ param.consumes = consumes;
1336
+ paramView = new ParameterView({
1337
+ model: param,
1338
+ tagName: 'tr',
1339
+ readOnly: this.model.isReadOnly
1340
+ });
1341
+ return $('.operation-params', $(this.el)).append(paramView.render().el);
1342
+ };
1343
+
1344
+ OperationView.prototype.addStatusCode = function(statusCode) {
1345
+ var statusCodeView;
1346
+ statusCodeView = new StatusCodeView({
1347
+ model: statusCode,
1348
+ tagName: 'tr'
1349
+ });
1350
+ return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1351
+ };
1352
+
1353
+ OperationView.prototype.submitOperation = function(e) {
1354
+ var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
1355
+ if (e != null) {
1356
+ e.preventDefault();
1357
+ }
1358
+ form = $('.sandbox', $(this.el));
1359
+ error_free = true;
1360
+ form.find("input.required").each(function() {
1361
+ $(this).removeClass("error");
1362
+ if (jQuery.trim($(this).val()) === "") {
1363
+ $(this).addClass("error");
1364
+ $(this).wiggle({
1365
+ callback: (function(_this) {
1366
+ return function() {
1367
+ return $(_this).focus();
1368
+ };
1369
+ })(this)
1370
+ });
1371
+ return error_free = false;
1372
+ }
1373
+ });
1374
+ form.find("textarea.required").each(function() {
1375
+ $(this).removeClass("error");
1376
+ if (jQuery.trim($(this).val()) === "") {
1377
+ $(this).addClass("error");
1378
+ $(this).wiggle({
1379
+ callback: (function(_this) {
1380
+ return function() {
1381
+ return $(_this).focus();
1382
+ };
1383
+ })(this)
1384
+ });
1385
+ return error_free = false;
1386
+ }
1387
+ });
1388
+ if (error_free) {
1389
+ map = {};
1390
+ opts = {
1391
+ parent: this
1392
+ };
1393
+ isFileUpload = false;
1394
+ _ref = form.find("input");
1395
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1396
+ o = _ref[_i];
1397
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1398
+ map[o.name] = o.value;
1399
+ }
1400
+ if (o.type === "file") {
1401
+ map[o.name] = o.files[0];
1402
+ isFileUpload = true;
1403
+ }
1404
+ }
1405
+ _ref1 = form.find("textarea");
1406
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1407
+ o = _ref1[_j];
1408
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1409
+ map[o.name] = o.value;
1410
+ }
1411
+ }
1412
+ _ref2 = form.find("select");
1413
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1414
+ o = _ref2[_k];
1415
+ val = this.getSelectedValue(o);
1416
+ if ((val != null) && jQuery.trim(val).length > 0) {
1417
+ map[o.name] = val;
1418
+ }
1419
+ }
1420
+ opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1421
+ opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1422
+ $(".response_throbber", $(this.el)).show();
1423
+ if (isFileUpload) {
1424
+ return this.handleFileUpload(map, form);
1425
+ } else {
1426
+ return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1427
+ }
1428
+ }
1429
+ };
1430
+
1431
+ OperationView.prototype.success = function(response, parent) {
1432
+ return parent.showCompleteStatus(response);
1433
+ };
1434
+
1435
+ OperationView.prototype.handleFileUpload = function(map, form) {
1436
+ var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
1437
+ _ref = form.serializeArray();
1438
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1439
+ o = _ref[_i];
1440
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1441
+ map[o.name] = o.value;
1442
+ }
1443
+ }
1444
+ bodyParam = new FormData();
1445
+ params = 0;
1446
+ _ref1 = this.model.parameters;
1447
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1448
+ param = _ref1[_j];
1449
+ if (param.paramType === 'form' || param["in"] === 'formData') {
1450
+ if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
1451
+ bodyParam.append(param.name, map[param.name]);
1452
+ }
1453
+ }
1454
+ }
1455
+ headerParams = {};
1456
+ _ref2 = this.model.parameters;
1457
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1458
+ param = _ref2[_k];
1459
+ if (param.paramType === 'header') {
1460
+ headerParams[param.name] = map[param.name];
1461
+ }
1462
+ }
1463
+ _ref3 = form.find('input[type~="file"]');
1464
+ for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1465
+ el = _ref3[_l];
1466
+ if (typeof el.files[0] !== 'undefined') {
1467
+ bodyParam.append($(el).attr('name'), el.files[0]);
1468
+ params += 1;
1469
+ }
1470
+ }
1471
+ this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
1472
+ $(".request_url", $(this.el)).html("<pre></pre>");
1473
+ $(".request_url pre", $(this.el)).text(this.invocationUrl);
1474
+ obj = {
1475
+ type: this.model.method,
1476
+ url: this.invocationUrl,
1477
+ headers: headerParams,
1478
+ data: bodyParam,
1479
+ dataType: 'json',
1480
+ contentType: false,
1481
+ processData: false,
1482
+ error: (function(_this) {
1483
+ return function(data, textStatus, error) {
1484
+ return _this.showErrorStatus(_this.wrap(data), _this);
1485
+ };
1486
+ })(this),
1487
+ success: (function(_this) {
1488
+ return function(data) {
1489
+ return _this.showResponse(data, _this);
1490
+ };
1491
+ })(this),
1492
+ complete: (function(_this) {
1493
+ return function(data) {
1494
+ return _this.showCompleteStatus(_this.wrap(data), _this);
1495
+ };
1496
+ })(this)
1497
+ };
1498
+ if (window.authorizations) {
1499
+ window.authorizations.apply(obj);
1500
+ }
1501
+ if (params === 0) {
1502
+ obj.data.append("fake", "true");
1503
+ }
1504
+ jQuery.ajax(obj);
1505
+ return false;
1506
+ };
1507
+
1508
+ OperationView.prototype.wrap = function(data) {
1509
+ var h, headerArray, headers, i, o, _i, _len;
1510
+ headers = {};
1511
+ headerArray = data.getAllResponseHeaders().split("\r");
1512
+ for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1513
+ i = headerArray[_i];
1514
+ h = i.match(/^([^:]*?):(.*)$/);
1515
+ if (!h) {
1516
+ h = [];
1517
+ }
1518
+ h.shift();
1519
+ if (h[0] !== void 0 && h[1] !== void 0) {
1520
+ headers[h[0].trim()] = h[1].trim();
1521
+ }
1522
+ }
1523
+ o = {};
1524
+ o.content = {};
1525
+ o.content.data = data.responseText;
1526
+ o.headers = headers;
1527
+ o.request = {};
1528
+ o.request.url = this.invocationUrl;
1529
+ o.status = data.status;
1530
+ return o;
1531
+ };
1532
+
1533
+ OperationView.prototype.getSelectedValue = function(select) {
1534
+ var opt, options, _i, _len, _ref;
1535
+ if (!select.multiple) {
1536
+ return select.value;
1537
+ } else {
1538
+ options = [];
1539
+ _ref = select.options;
1540
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1541
+ opt = _ref[_i];
1542
+ if (opt.selected) {
1543
+ options.push(opt.value);
1544
+ }
1545
+ }
1546
+ if (options.length > 0) {
1547
+ return options;
1548
+ } else {
1549
+ return null;
1550
+ }
1551
+ }
1552
+ };
1553
+
1554
+ OperationView.prototype.hideResponse = function(e) {
1555
+ if (e != null) {
1556
+ e.preventDefault();
1557
+ }
1558
+ $(".response", $(this.el)).slideUp();
1559
+ return $(".response_hider", $(this.el)).fadeOut();
1560
+ };
1561
+
1562
+ OperationView.prototype.showResponse = function(response) {
1563
+ var prettyJson;
1564
+ prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1565
+ return $(".response_body", $(this.el)).html(escape(prettyJson));
1566
+ };
1567
+
1568
+ OperationView.prototype.showErrorStatus = function(data, parent) {
1569
+ return parent.showStatus(data);
1570
+ };
1571
+
1572
+ OperationView.prototype.showCompleteStatus = function(data, parent) {
1573
+ return parent.showStatus(data);
1574
+ };
1575
+
1576
+ OperationView.prototype.formatXml = function(xml) {
1577
+ var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1578
+ reg = /(>)(<)(\/*)/g;
1579
+ wsexp = /[ ]*(.*)[ ]+\n/g;
1580
+ contexp = /(<.+>)(.+\n)/g;
1581
+ xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1582
+ pad = 0;
1583
+ formatted = '';
1584
+ lines = xml.split('\n');
1585
+ indent = 0;
1586
+ lastType = 'other';
1587
+ transitions = {
1588
+ 'single->single': 0,
1589
+ 'single->closing': -1,
1590
+ 'single->opening': 0,
1591
+ 'single->other': 0,
1592
+ 'closing->single': 0,
1593
+ 'closing->closing': -1,
1594
+ 'closing->opening': 0,
1595
+ 'closing->other': 0,
1596
+ 'opening->single': 1,
1597
+ 'opening->closing': 0,
1598
+ 'opening->opening': 1,
1599
+ 'opening->other': 1,
1600
+ 'other->single': 0,
1601
+ 'other->closing': -1,
1602
+ 'other->opening': 0,
1603
+ 'other->other': 0
1604
+ };
1605
+ _fn = function(ln) {
1606
+ var fromTo, j, key, padding, type, types, value;
1607
+ types = {
1608
+ single: Boolean(ln.match(/<.+\/>/)),
1609
+ closing: Boolean(ln.match(/<\/.+>/)),
1610
+ opening: Boolean(ln.match(/<[^!?].*>/))
1611
+ };
1612
+ type = ((function() {
1613
+ var _results;
1614
+ _results = [];
1615
+ for (key in types) {
1616
+ value = types[key];
1617
+ if (value) {
1618
+ _results.push(key);
1619
+ }
1620
+ }
1621
+ return _results;
1622
+ })())[0];
1623
+ type = type === void 0 ? 'other' : type;
1624
+ fromTo = lastType + '->' + type;
1625
+ lastType = type;
1626
+ padding = '';
1627
+ indent += transitions[fromTo];
1628
+ padding = ((function() {
1629
+ var _j, _ref, _results;
1630
+ _results = [];
1631
+ for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
1632
+ _results.push(' ');
1633
+ }
1634
+ return _results;
1635
+ })()).join('');
1636
+ if (fromTo === 'opening->closing') {
1637
+ return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1638
+ } else {
1639
+ return formatted += padding + ln + '\n';
1640
+ }
1641
+ };
1642
+ for (_i = 0, _len = lines.length; _i < _len; _i++) {
1643
+ ln = lines[_i];
1644
+ _fn(ln);
1645
+ }
1646
+ return formatted;
1647
+ };
1648
+
1649
+ OperationView.prototype.showStatus = function(response) {
1650
+ var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
1651
+ if (response.content === void 0) {
1652
+ content = response.data;
1653
+ url = response.url;
1654
+ } else {
1655
+ content = response.content.data;
1656
+ url = response.request.url;
1657
+ }
1658
+ headers = response.headers;
1659
+ contentType = null;
1660
+ if (headers) {
1661
+ contentType = headers["Content-Type"] || headers["content-type"];
1662
+ if (contentType) {
1663
+ contentType = contentType.split(";")[0].trim();
1664
+ }
1665
+ }
1666
+ $(".response_body", $(this.el)).removeClass('json');
1667
+ $(".response_body", $(this.el)).removeClass('xml');
1668
+ if (!content) {
1669
+ code = $('<code />').text("no content");
1670
+ pre = $('<pre class="json" />').append(code);
1671
+ } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1672
+ json = null;
1673
+ try {
1674
+ json = JSON.stringify(JSON.parse(content), null, " ");
1675
+ } catch (_error) {
1676
+ e = _error;
1677
+ json = "can't parse JSON. Raw result:\n\n" + content;
1678
+ }
1679
+ code = $('<code />').text(json);
1680
+ pre = $('<pre class="json" />').append(code);
1681
+ } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1682
+ code = $('<code />').text(this.formatXml(content));
1683
+ pre = $('<pre class="xml" />').append(code);
1684
+ } else if (contentType === "text/html") {
1685
+ code = $('<code />').html(_.escape(content));
1686
+ pre = $('<pre class="xml" />').append(code);
1687
+ } else if (/^image\//.test(contentType)) {
1688
+ pre = $('<img>').attr('src', url);
1689
+ } else {
1690
+ code = $('<code />').text(content);
1691
+ pre = $('<pre class="json" />').append(code);
1692
+ }
1693
+ response_body = pre;
1694
+ $(".request_url", $(this.el)).html("<pre></pre>");
1695
+ $(".request_url pre", $(this.el)).text(url);
1696
+ $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1697
+ $(".response_body", $(this.el)).html(response_body);
1698
+ $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
1699
+ $(".response", $(this.el)).slideDown();
1700
+ $(".response_hider", $(this.el)).show();
1701
+ $(".response_throbber", $(this.el)).hide();
1702
+ response_body_el = $('.response_body', $(this.el))[0];
1703
+ opts = this.options.swaggerOptions;
1704
+ if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
1705
+ return response_body_el;
1706
+ } else {
1707
+ return hljs.highlightBlock(response_body_el);
1708
+ }
1709
+ };
1710
+
1711
+ OperationView.prototype.toggleOperationContent = function() {
1712
+ var elem;
1713
+ elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
1714
+ if (elem.is(':visible')) {
1715
+ return Docs.collapseOperation(elem);
1716
+ } else {
1717
+ return Docs.expandOperation(elem);
1718
+ }
1719
+ };
1720
+
1721
+ return OperationView;
1722
+
1723
+ })(Backbone.View);
1724
+
1725
+ var ParameterContentTypeView,
1726
+ __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; },
1727
+ __hasProp = {}.hasOwnProperty;
1728
+
1729
+ ParameterContentTypeView = (function(_super) {
1730
+ __extends(ParameterContentTypeView, _super);
1731
+
1732
+ function ParameterContentTypeView() {
1733
+ return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
1734
+ }
1735
+
1736
+ ParameterContentTypeView.prototype.initialize = function() {};
1737
+
1738
+ ParameterContentTypeView.prototype.render = function() {
1739
+ var template;
1740
+ template = this.template();
1741
+ $(this.el).html(template(this.model));
1742
+ $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
1743
+ return this;
1744
+ };
1745
+
1746
+ ParameterContentTypeView.prototype.template = function() {
1747
+ return Handlebars.templates.parameter_content_type;
1748
+ };
1749
+
1750
+ return ParameterContentTypeView;
1751
+
1752
+ })(Backbone.View);
1753
+
1754
+ this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1755
+ var stack1, buffer = "";
1756
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
1757
+ if (stack1 != null) { buffer += stack1; }
1758
+ return buffer;
1759
+ },"2":function(depth0,helpers,partials,data) {
1760
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1761
+ return " <input type=\"file\" name='"
1762
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1763
+ + "'/>\n";
1764
+ },"4":function(depth0,helpers,partials,data) {
1765
+ var stack1, buffer = "";
1766
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
1767
+ if (stack1 != null) { buffer += stack1; }
1768
+ return buffer;
1769
+ },"5":function(depth0,helpers,partials,data) {
1770
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1771
+ return " <textarea class='body-textarea required' placeholder='(required)' name='"
1772
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1773
+ + "'>"
1774
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1775
+ + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1776
+ },"7":function(depth0,helpers,partials,data) {
1777
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1778
+ return " <textarea class='body-textarea required' placeholder='(required)' name='"
1779
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1780
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1781
+ },"9":function(depth0,helpers,partials,data) {
1782
+ var stack1, buffer = "";
1783
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
1784
+ if (stack1 != null) { buffer += stack1; }
1785
+ return buffer;
1786
+ },"10":function(depth0,helpers,partials,data) {
1787
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1788
+ return " <input class='parameter' class='required' type='file' name='"
1789
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1790
+ + "'/>\n";
1791
+ },"12":function(depth0,helpers,partials,data) {
1792
+ var stack1, buffer = "";
1793
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
1794
+ if (stack1 != null) { buffer += stack1; }
1795
+ return buffer;
1796
+ },"13":function(depth0,helpers,partials,data) {
1797
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1798
+ return " <input class='parameter required' minlength='1' name='"
1799
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1800
+ + "' placeholder='(required)' type='text' value='"
1801
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1802
+ + "'/>\n";
1803
+ },"15":function(depth0,helpers,partials,data) {
1804
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1805
+ return " <input class='parameter required' minlength='1' name='"
1806
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1807
+ + "' placeholder='(required)' type='text' value=''/>\n";
1808
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1809
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1810
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1811
+ + "</td>\n<td>\n";
1812
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
1813
+ if (stack1 != null) { buffer += stack1; }
1814
+ buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
1815
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1816
+ if (stack1 != null) { buffer += stack1; }
1817
+ buffer += "</span></strong>\n</td>\n<td>";
1818
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1819
+ if (stack1 != null) { buffer += stack1; }
1820
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1821
+ },"useData":true});
1822
+ this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1823
+ var stack1, buffer = "";
1824
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
1825
+ if (stack1 != null) { buffer += stack1; }
1826
+ return buffer;
1827
+ },"2":function(depth0,helpers,partials,data) {
1828
+ var stack1, lambda=this.lambda, buffer = " <option value=\"";
1829
+ stack1 = lambda(depth0, depth0);
1830
+ if (stack1 != null) { buffer += stack1; }
1831
+ buffer += "\">";
1832
+ stack1 = lambda(depth0, depth0);
1833
+ if (stack1 != null) { buffer += stack1; }
1834
+ return buffer + "</option>\n";
1835
+ },"4":function(depth0,helpers,partials,data) {
1836
+ return " <option value=\"application/json\">application/json</option>\n";
1837
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1838
+ var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1839
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
1840
+ if (stack1 != null) { buffer += stack1; }
1841
+ return buffer + "</select>\n";
1842
+ },"useData":true});
1843
+ var ParameterView,
1844
+ __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; },
1845
+ __hasProp = {}.hasOwnProperty;
1846
+
1847
+ ParameterView = (function(_super) {
1848
+ __extends(ParameterView, _super);
1849
+
1850
+ function ParameterView() {
1851
+ return ParameterView.__super__.constructor.apply(this, arguments);
1852
+ }
1853
+
1854
+ ParameterView.prototype.initialize = function() {
1855
+ return Handlebars.registerHelper('isArray', function(param, opts) {
1856
+ if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
1857
+ return opts.fn(this);
1858
+ } else {
1859
+ return opts.inverse(this);
1860
+ }
1861
+ });
1862
+ };
1863
+
1864
+ ParameterView.prototype.render = function() {
1865
+ var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
1866
+ type = this.model.type || this.model.dataType;
1867
+ if (typeof type === 'undefined') {
1868
+ schema = this.model.schema;
1869
+ if (schema && schema['$ref']) {
1870
+ ref = schema['$ref'];
1871
+ if (ref.indexOf('#/definitions/') === 0) {
1872
+ type = ref.substring('#/definitions/'.length);
1873
+ } else {
1874
+ type = ref;
1875
+ }
1876
+ }
1877
+ }
1878
+ this.model.type = type;
1879
+ this.model.paramType = this.model["in"] || this.model.paramType;
1880
+ if (this.model.paramType === 'body' || this.model["in"] === 'body') {
1881
+ this.model.isBody = true;
1882
+ }
1883
+ if (type && type.toLowerCase() === 'file') {
1884
+ this.model.isFile = true;
1885
+ }
1886
+ this.model["default"] = this.model["default"] || this.model.defaultValue;
1887
+ if (this.model.allowableValues) {
1888
+ this.model.isList = true;
1889
+ }
1890
+ template = this.template();
1891
+ $(this.el).html(template(this.model));
1892
+ signatureModel = {
1893
+ sampleJSON: this.model.sampleJSON,
1894
+ isParam: true,
1895
+ signature: this.model.signature
1896
+ };
1897
+ if (this.model.sampleJSON) {
1898
+ signatureView = new SignatureView({
1899
+ model: signatureModel,
1900
+ tagName: 'div'
1901
+ });
1902
+ $('.model-signature', $(this.el)).append(signatureView.render().el);
1903
+ } else {
1904
+ $('.model-signature', $(this.el)).html(this.model.signature);
1905
+ }
1906
+ isParam = false;
1907
+ if (this.model.isBody) {
1908
+ isParam = true;
1909
+ }
1910
+ contentTypeModel = {
1911
+ isParam: isParam
1912
+ };
1913
+ contentTypeModel.consumes = this.model.consumes;
1914
+ if (isParam) {
1915
+ parameterContentTypeView = new ParameterContentTypeView({
1916
+ model: contentTypeModel
1917
+ });
1918
+ $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1919
+ } else {
1920
+ responseContentTypeView = new ResponseContentTypeView({
1921
+ model: contentTypeModel
1922
+ });
1923
+ $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1924
+ }
1925
+ return this;
1926
+ };
1927
+
1928
+ ParameterView.prototype.template = function() {
1929
+ if (this.model.isList) {
1930
+ return Handlebars.templates.param_list;
1931
+ } else {
1932
+ if (this.options.readOnly) {
1933
+ if (this.model.required) {
1934
+ return Handlebars.templates.param_readonly_required;
1935
+ } else {
1936
+ return Handlebars.templates.param_readonly;
1937
+ }
1938
+ } else {
1939
+ if (this.model.required) {
1940
+ return Handlebars.templates.param_required;
1941
+ } else {
1942
+ return Handlebars.templates.param;
1943
+ }
1944
+ }
1945
+ }
1946
+ };
1947
+
1948
+ return ParameterView;
1949
+
1950
+ })(Backbone.View);
1951
+
1952
+ var ResourceView,
1953
+ __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; },
1954
+ __hasProp = {}.hasOwnProperty;
1955
+
1956
+ ResourceView = (function(_super) {
1957
+ __extends(ResourceView, _super);
1958
+
1959
+ function ResourceView() {
1960
+ return ResourceView.__super__.constructor.apply(this, arguments);
1961
+ }
1962
+
1963
+ ResourceView.prototype.initialize = function(opts) {
1964
+ if (opts == null) {
1965
+ opts = {};
1966
+ }
1967
+ this.auths = opts.auths;
1968
+ if ("" === this.model.description) {
1969
+ this.model.description = null;
1970
+ }
1971
+ if (this.model.description != null) {
1972
+ return this.model.summary = this.model.description;
1973
+ }
1974
+ };
1975
+
1976
+ ResourceView.prototype.render = function() {
1977
+ var counter, id, methods, operation, _i, _len, _ref;
1978
+ methods = {};
1979
+ $(this.el).html(Handlebars.templates.resource(this.model));
1980
+ _ref = this.model.operationsArray;
1981
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1982
+ operation = _ref[_i];
1983
+ counter = 0;
1984
+ id = operation.nickname;
1985
+ while (typeof methods[id] !== 'undefined') {
1986
+ id = id + "_" + counter;
1987
+ counter += 1;
1988
+ }
1989
+ methods[id] = operation;
1990
+ operation.nickname = id;
1991
+ operation.parentId = this.model.id;
1992
+ this.addOperation(operation);
1993
+ }
1994
+ $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
1995
+ $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
1996
+ $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
1997
+ return this;
1998
+ };
1999
+
2000
+ ResourceView.prototype.addOperation = function(operation) {
2001
+ var operationView;
2002
+ operation.number = this.number;
2003
+ operationView = new OperationView({
2004
+ model: operation,
2005
+ tagName: 'li',
2006
+ className: 'endpoint',
2007
+ swaggerOptions: this.options.swaggerOptions,
2008
+ auths: this.auths
2009
+ });
2010
+ $('.endpoints', $(this.el)).append(operationView.render().el);
2011
+ return this.number++;
2012
+ };
2013
+
2014
+ ResourceView.prototype.callDocs = function(fnName, e) {
2015
+ e.preventDefault();
2016
+ return Docs[fnName](e.currentTarget.getAttribute('data-id'));
2017
+ };
2018
+
2019
+ return ResourceView;
2020
+
2021
+ })(Backbone.View);
2022
+
2023
+ this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2024
+ return " : ";
2025
+ },"3":function(depth0,helpers,partials,data) {
2026
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
2027
+ return "<li>\n <a href='"
2028
+ + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
2029
+ + "'>Raw</a>\n </li>";
2030
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2031
+ var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
2032
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2033
+ + "' class=\"toggleEndpointList\" data-id=\""
2034
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2035
+ + "\">"
2036
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
2037
+ + "</a> ";
2038
+ stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2039
+ if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2040
+ if (stack1 != null) { buffer += stack1; }
2041
+ stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
2042
+ if (stack1 != null) { buffer += stack1; }
2043
+ buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
2044
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2045
+ + "' id='endpointListTogger_"
2046
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2047
+ + "' class=\"toggleEndpointList\" data-id=\""
2048
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2049
+ + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
2050
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2051
+ + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
2052
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2053
+ + "\">\n Expand Operations\n </a>\n </li>\n ";
2054
+ stack1 = ((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(options={"name":"url","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2055
+ if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2056
+ if (stack1 != null) { buffer += stack1; }
2057
+ return buffer + "\n </ul>\n</div>\n<ul class='endpoints' id='"
2058
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2059
+ + "_endpoint_list' style='display:none'>\n\n</ul>\n";
2060
+ },"useData":true});
2061
+ var ResponseContentTypeView,
2062
+ __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; },
2063
+ __hasProp = {}.hasOwnProperty;
2064
+
2065
+ ResponseContentTypeView = (function(_super) {
2066
+ __extends(ResponseContentTypeView, _super);
2067
+
2068
+ function ResponseContentTypeView() {
2069
+ return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2070
+ }
2071
+
2072
+ ResponseContentTypeView.prototype.initialize = function() {};
2073
+
2074
+ ResponseContentTypeView.prototype.render = function() {
2075
+ var template;
2076
+ template = this.template();
2077
+ $(this.el).html(template(this.model));
2078
+ $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2079
+ return this;
2080
+ };
2081
+
2082
+ ResponseContentTypeView.prototype.template = function() {
2083
+ return Handlebars.templates.response_content_type;
2084
+ };
2085
+
2086
+ return ResponseContentTypeView;
2087
+
2088
+ })(Backbone.View);
2089
+
2090
+ this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2091
+ var stack1, buffer = "";
2092
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
2093
+ if (stack1 != null) { buffer += stack1; }
2094
+ return buffer;
2095
+ },"2":function(depth0,helpers,partials,data) {
2096
+ var stack1, lambda=this.lambda, buffer = " <option value=\"";
2097
+ stack1 = lambda(depth0, depth0);
2098
+ if (stack1 != null) { buffer += stack1; }
2099
+ buffer += "\">";
2100
+ stack1 = lambda(depth0, depth0);
2101
+ if (stack1 != null) { buffer += stack1; }
2102
+ return buffer + "</option>\n";
2103
+ },"4":function(depth0,helpers,partials,data) {
2104
+ return " <option value=\"application/json\">application/json</option>\n";
2105
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2106
+ var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
2107
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
2108
+ if (stack1 != null) { buffer += stack1; }
2109
+ return buffer + "</select>\n";
2110
+ },"useData":true});
2111
+ var SignatureView,
2112
+ __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; },
2113
+ __hasProp = {}.hasOwnProperty;
2114
+
2115
+ SignatureView = (function(_super) {
2116
+ __extends(SignatureView, _super);
2117
+
2118
+ function SignatureView() {
2119
+ return SignatureView.__super__.constructor.apply(this, arguments);
2120
+ }
2121
+
2122
+ SignatureView.prototype.events = {
2123
+ 'click a.description-link': 'switchToDescription',
2124
+ 'click a.snippet-link': 'switchToSnippet',
2125
+ 'mousedown .snippet': 'snippetToTextArea'
2126
+ };
2127
+
2128
+ SignatureView.prototype.initialize = function() {};
2129
+
2130
+ SignatureView.prototype.render = function() {
2131
+ var template;
2132
+ template = this.template();
2133
+ $(this.el).html(template(this.model));
2134
+ this.switchToSnippet();
2135
+ this.isParam = this.model.isParam;
2136
+ if (this.isParam) {
2137
+ $('.notice', $(this.el)).text('Click to set as parameter value');
2138
+ }
2139
+ return this;
2140
+ };
2141
+
2142
+ SignatureView.prototype.template = function() {
2143
+ return Handlebars.templates.signature;
2144
+ };
2145
+
2146
+ SignatureView.prototype.switchToDescription = function(e) {
2147
+ if (e != null) {
2148
+ e.preventDefault();
2149
+ }
2150
+ $(".snippet", $(this.el)).hide();
2151
+ $(".description", $(this.el)).show();
2152
+ $('.description-link', $(this.el)).addClass('selected');
2153
+ return $('.snippet-link', $(this.el)).removeClass('selected');
2154
+ };
2155
+
2156
+ SignatureView.prototype.switchToSnippet = function(e) {
2157
+ if (e != null) {
2158
+ e.preventDefault();
2159
+ }
2160
+ $(".description", $(this.el)).hide();
2161
+ $(".snippet", $(this.el)).show();
2162
+ $('.snippet-link', $(this.el)).addClass('selected');
2163
+ return $('.description-link', $(this.el)).removeClass('selected');
2164
+ };
2165
+
2166
+ SignatureView.prototype.snippetToTextArea = function(e) {
2167
+ var textArea;
2168
+ if (this.isParam) {
2169
+ if (e != null) {
2170
+ e.preventDefault();
2171
+ }
2172
+ textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2173
+ if ($.trim(textArea.val()) === '') {
2174
+ return textArea.val(this.model.sampleJSON);
2175
+ }
2176
+ }
2177
+ };
2178
+
2179
+ return SignatureView;
2180
+
2181
+ })(Backbone.View);
2182
+
2183
+ this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2184
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
2185
+ stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
2186
+ if (stack1 != null) { buffer += stack1; }
2187
+ return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
2188
+ + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
2189
+ + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
2190
+ },"useData":true});
2191
+ var StatusCodeView,
2192
+ __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; },
2193
+ __hasProp = {}.hasOwnProperty;
2194
+
2195
+ StatusCodeView = (function(_super) {
2196
+ __extends(StatusCodeView, _super);
2197
+
2198
+ function StatusCodeView() {
2199
+ return StatusCodeView.__super__.constructor.apply(this, arguments);
2200
+ }
2201
+
2202
+ StatusCodeView.prototype.initialize = function() {};
2203
+
2204
+ StatusCodeView.prototype.render = function() {
2205
+ var responseModel, responseModelView, template;
2206
+ template = this.template();
2207
+ $(this.el).html(template(this.model));
2208
+ if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2209
+ responseModel = {
2210
+ sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2211
+ isParam: false,
2212
+ signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2213
+ };
2214
+ responseModelView = new SignatureView({
2215
+ model: responseModel,
2216
+ tagName: 'div'
2217
+ });
2218
+ $('.model-signature', this.$el).append(responseModelView.render().el);
2219
+ } else {
2220
+ $('.model-signature', this.$el).html('');
2221
+ }
2222
+ return this;
2223
+ };
2224
+
2225
+ StatusCodeView.prototype.template = function() {
2226
+ return Handlebars.templates.status_code;
2227
+ };
2228
+
2229
+ return StatusCodeView;
2230
+
2231
+ })(Backbone.View);
2232
+
2233
+ this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2234
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
2235
+ + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
2236
+ + "</td>\n<td>";
2237
+ stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
2238
+ if (stack1 != null) { buffer += stack1; }
2239
+ return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
2240
+ },"useData":true});