swagger-ui_rails_audionerd 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +45 -0
  4. data/Rakefile +46 -0
  5. data/app/assets/images/explorer_icons.png +0 -0
  6. data/app/assets/images/logo_small.png +0 -0
  7. data/app/assets/images/throbber.gif +0 -0
  8. data/app/assets/javascripts/swagger-oauth.js +211 -0
  9. data/app/assets/javascripts/swagger-ui/index.js +12 -0
  10. data/app/assets/javascripts/swagger-ui/lib/backbone-min.js +15 -0
  11. data/app/assets/javascripts/swagger-ui/lib/handlebars-2.0.0.js +28 -0
  12. data/app/assets/javascripts/swagger-ui/lib/highlight.7.3.pack.js +1 -0
  13. data/app/assets/javascripts/swagger-ui/lib/jquery-1.8.0.min.js +2 -0
  14. data/app/assets/javascripts/swagger-ui/lib/jquery.ba-bbq.min.js +18 -0
  15. data/app/assets/javascripts/swagger-ui/lib/jquery.slideto.min.js +1 -0
  16. data/app/assets/javascripts/swagger-ui/lib/jquery.wiggle.min.js +8 -0
  17. data/app/assets/javascripts/swagger-ui/lib/marked.js +1272 -0
  18. data/app/assets/javascripts/swagger-ui/lib/shred.bundle.js +2765 -0
  19. data/app/assets/javascripts/swagger-ui/lib/swagger-client.js +3294 -0
  20. data/app/assets/javascripts/swagger-ui/lib/underscore-min.js +6 -0
  21. data/app/assets/javascripts/swagger-ui/swagger-oauth.js +279 -0
  22. data/app/assets/javascripts/swagger-ui/swagger-ui.js.erb +2240 -0
  23. data/app/assets/stylesheets/swagger-ui/index.css +5 -0
  24. data/app/assets/stylesheets/swagger-ui/reset.css +125 -0
  25. data/app/assets/stylesheets/swagger-ui/screen.css +1256 -0
  26. data/app/views/swagger_ui/_swagger_ui.html.erb +37 -0
  27. data/lib/swagger-ui_rails.rb +7 -0
  28. data/lib/swagger-ui_rails/engine.rb +14 -0
  29. data/lib/swagger-ui_rails/version.rb +5 -0
  30. metadata +100 -0
@@ -0,0 +1,6 @@
1
+ // Underscore.js 1.7.0
2
+ // http://underscorejs.org
3
+ // (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4
+ // Underscore may be freely distributed under the MIT license.
5
+ (function(){var n=this,t=n._,r=Array.prototype,e=Object.prototype,u=Function.prototype,i=r.push,a=r.slice,o=r.concat,l=e.toString,c=e.hasOwnProperty,f=Array.isArray,s=Object.keys,p=u.bind,h=function(n){return n instanceof h?n:this instanceof h?void(this._wrapped=n):new h(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=h),exports._=h):n._=h,h.VERSION="1.7.0";var g=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}};h.iteratee=function(n,t,r){return null==n?h.identity:h.isFunction(n)?g(n,t,r):h.isObject(n)?h.matches(n):h.property(n)},h.each=h.forEach=function(n,t,r){if(null==n)return n;t=g(t,r);var e,u=n.length;if(u===+u)for(e=0;u>e;e++)t(n[e],e,n);else{var i=h.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},h.map=h.collect=function(n,t,r){if(null==n)return[];t=h.iteratee(t,r);for(var e,u=n.length!==+n.length&&h.keys(n),i=(u||n).length,a=Array(i),o=0;i>o;o++)e=u?u[o]:o,a[o]=t(n[e],e,n);return a};var v="Reduce of empty array with no initial value";h.reduce=h.foldl=h.inject=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length,o=0;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[o++]:o++]}for(;a>o;o++)u=i?i[o]:o,r=t(r,n[u],u,n);return r},h.reduceRight=h.foldr=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[--a]:--a]}for(;a--;)u=i?i[a]:a,r=t(r,n[u],u,n);return r},h.find=h.detect=function(n,t,r){var e;return t=h.iteratee(t,r),h.some(n,function(n,r,u){return t(n,r,u)?(e=n,!0):void 0}),e},h.filter=h.select=function(n,t,r){var e=[];return null==n?e:(t=h.iteratee(t,r),h.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e)},h.reject=function(n,t,r){return h.filter(n,h.negate(h.iteratee(t)),r)},h.every=h.all=function(n,t,r){if(null==n)return!0;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,!t(n[u],u,n))return!1;return!0},h.some=h.any=function(n,t,r){if(null==n)return!1;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,t(n[u],u,n))return!0;return!1},h.contains=h.include=function(n,t){return null==n?!1:(n.length!==+n.length&&(n=h.values(n)),h.indexOf(n,t)>=0)},h.invoke=function(n,t){var r=a.call(arguments,2),e=h.isFunction(t);return h.map(n,function(n){return(e?t:n[t]).apply(n,r)})},h.pluck=function(n,t){return h.map(n,h.property(t))},h.where=function(n,t){return h.filter(n,h.matches(t))},h.findWhere=function(n,t){return h.find(n,h.matches(t))},h.max=function(n,t,r){var e,u,i=-1/0,a=-1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],e>i&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(u>a||u===-1/0&&i===-1/0)&&(i=n,a=u)});return i},h.min=function(n,t,r){var e,u,i=1/0,a=1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],i>e&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(a>u||1/0===u&&1/0===i)&&(i=n,a=u)});return i},h.shuffle=function(n){for(var t,r=n&&n.length===+n.length?n:h.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=h.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},h.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=h.values(n)),n[h.random(n.length-1)]):h.shuffle(n).slice(0,Math.max(0,t))},h.sortBy=function(n,t,r){return t=h.iteratee(t,r),h.pluck(h.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var m=function(n){return function(t,r,e){var u={};return r=h.iteratee(r,e),h.each(t,function(e,i){var a=r(e,i,t);n(u,e,a)}),u}};h.groupBy=m(function(n,t,r){h.has(n,r)?n[r].push(t):n[r]=[t]}),h.indexBy=m(function(n,t,r){n[r]=t}),h.countBy=m(function(n,t,r){h.has(n,r)?n[r]++:n[r]=1}),h.sortedIndex=function(n,t,r,e){r=h.iteratee(r,e,1);for(var u=r(t),i=0,a=n.length;a>i;){var o=i+a>>>1;r(n[o])<u?i=o+1:a=o}return i},h.toArray=function(n){return n?h.isArray(n)?a.call(n):n.length===+n.length?h.map(n,h.identity):h.values(n):[]},h.size=function(n){return null==n?0:n.length===+n.length?n.length:h.keys(n).length},h.partition=function(n,t,r){t=h.iteratee(t,r);var e=[],u=[];return h.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},h.first=h.head=h.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:0>t?[]:a.call(n,0,t)},h.initial=function(n,t,r){return a.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},h.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:a.call(n,Math.max(n.length-t,0))},h.rest=h.tail=h.drop=function(n,t,r){return a.call(n,null==t||r?1:t)},h.compact=function(n){return h.filter(n,h.identity)};var y=function(n,t,r,e){if(t&&h.every(n,h.isArray))return o.apply(e,n);for(var u=0,a=n.length;a>u;u++){var l=n[u];h.isArray(l)||h.isArguments(l)?t?i.apply(e,l):y(l,t,r,e):r||e.push(l)}return e};h.flatten=function(n,t){return y(n,t,!1,[])},h.without=function(n){return h.difference(n,a.call(arguments,1))},h.uniq=h.unique=function(n,t,r,e){if(null==n)return[];h.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=h.iteratee(r,e));for(var u=[],i=[],a=0,o=n.length;o>a;a++){var l=n[a];if(t)a&&i===l||u.push(l),i=l;else if(r){var c=r(l,a,n);h.indexOf(i,c)<0&&(i.push(c),u.push(l))}else h.indexOf(u,l)<0&&u.push(l)}return u},h.union=function(){return h.uniq(y(arguments,!0,!0,[]))},h.intersection=function(n){if(null==n)return[];for(var t=[],r=arguments.length,e=0,u=n.length;u>e;e++){var i=n[e];if(!h.contains(t,i)){for(var a=1;r>a&&h.contains(arguments[a],i);a++);a===r&&t.push(i)}}return t},h.difference=function(n){var t=y(a.call(arguments,1),!0,!0,[]);return h.filter(n,function(n){return!h.contains(t,n)})},h.zip=function(n){if(null==n)return[];for(var t=h.max(arguments,"length").length,r=Array(t),e=0;t>e;e++)r[e]=h.pluck(arguments,e);return r},h.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},h.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=h.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}for(;u>e;e++)if(n[e]===t)return e;return-1},h.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=n.length;for("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1));--e>=0;)if(n[e]===t)return e;return-1},h.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var d=function(){};h.bind=function(n,t){var r,e;if(p&&n.bind===p)return p.apply(n,a.call(arguments,1));if(!h.isFunction(n))throw new TypeError("Bind must be called on a function");return r=a.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(a.call(arguments)));d.prototype=n.prototype;var u=new d;d.prototype=null;var i=n.apply(u,r.concat(a.call(arguments)));return h.isObject(i)?i:u}},h.partial=function(n){var t=a.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===h&&(e[u]=arguments[r++]);for(;r<arguments.length;)e.push(arguments[r++]);return n.apply(this,e)}},h.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=h.bind(n[r],n);return n},h.memoize=function(n,t){var r=function(e){var u=r.cache,i=t?t.apply(this,arguments):e;return h.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},h.delay=function(n,t){var r=a.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},h.defer=function(n){return h.delay.apply(h,[n,1].concat(a.call(arguments,1)))},h.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var l=function(){o=r.leading===!1?0:h.now(),a=null,i=n.apply(e,u),a||(e=u=null)};return function(){var c=h.now();o||r.leading!==!1||(o=c);var f=t-(c-o);return e=this,u=arguments,0>=f||f>t?(clearTimeout(a),a=null,o=c,i=n.apply(e,u),a||(e=u=null)):a||r.trailing===!1||(a=setTimeout(l,f)),i}},h.debounce=function(n,t,r){var e,u,i,a,o,l=function(){var c=h.now()-a;t>c&&c>0?e=setTimeout(l,t-c):(e=null,r||(o=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,a=h.now();var c=r&&!e;return e||(e=setTimeout(l,t)),c&&(o=n.apply(i,u),i=u=null),o}},h.wrap=function(n,t){return h.partial(t,n)},h.negate=function(n){return function(){return!n.apply(this,arguments)}},h.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},h.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},h.before=function(n,t){var r;return function(){return--n>0?r=t.apply(this,arguments):t=null,r}},h.once=h.partial(h.before,2),h.keys=function(n){if(!h.isObject(n))return[];if(s)return s(n);var t=[];for(var r in n)h.has(n,r)&&t.push(r);return t},h.values=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},h.pairs=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},h.invert=function(n){for(var t={},r=h.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},h.functions=h.methods=function(n){var t=[];for(var r in n)h.isFunction(n[r])&&t.push(r);return t.sort()},h.extend=function(n){if(!h.isObject(n))return n;for(var t,r,e=1,u=arguments.length;u>e;e++){t=arguments[e];for(r in t)c.call(t,r)&&(n[r]=t[r])}return n},h.pick=function(n,t,r){var e,u={};if(null==n)return u;if(h.isFunction(t)){t=g(t,r);for(e in n){var i=n[e];t(i,e,n)&&(u[e]=i)}}else{var l=o.apply([],a.call(arguments,1));n=new Object(n);for(var c=0,f=l.length;f>c;c++)e=l[c],e in n&&(u[e]=n[e])}return u},h.omit=function(n,t,r){if(h.isFunction(t))t=h.negate(t);else{var e=h.map(o.apply([],a.call(arguments,1)),String);t=function(n,t){return!h.contains(e,t)}}return h.pick(n,t,r)},h.defaults=function(n){if(!h.isObject(n))return n;for(var t=1,r=arguments.length;r>t;t++){var e=arguments[t];for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n},h.clone=function(n){return h.isObject(n)?h.isArray(n)?n.slice():h.extend({},n):n},h.tap=function(n,t){return t(n),n};var b=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof h&&(n=n._wrapped),t instanceof h&&(t=t._wrapped);var u=l.call(n);if(u!==l.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]===n)return e[i]===t;var a=n.constructor,o=t.constructor;if(a!==o&&"constructor"in n&&"constructor"in t&&!(h.isFunction(a)&&a instanceof a&&h.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c,f;if("[object Array]"===u){if(c=n.length,f=c===t.length)for(;c--&&(f=b(n[c],t[c],r,e)););}else{var s,p=h.keys(n);if(c=p.length,f=h.keys(t).length===c)for(;c--&&(s=p[c],f=h.has(t,s)&&b(n[s],t[s],r,e)););}return r.pop(),e.pop(),f};h.isEqual=function(n,t){return b(n,t,[],[])},h.isEmpty=function(n){if(null==n)return!0;if(h.isArray(n)||h.isString(n)||h.isArguments(n))return 0===n.length;for(var t in n)if(h.has(n,t))return!1;return!0},h.isElement=function(n){return!(!n||1!==n.nodeType)},h.isArray=f||function(n){return"[object Array]"===l.call(n)},h.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},h.each(["Arguments","Function","String","Number","Date","RegExp"],function(n){h["is"+n]=function(t){return l.call(t)==="[object "+n+"]"}}),h.isArguments(arguments)||(h.isArguments=function(n){return h.has(n,"callee")}),"function"!=typeof/./&&(h.isFunction=function(n){return"function"==typeof n||!1}),h.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},h.isNaN=function(n){return h.isNumber(n)&&n!==+n},h.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===l.call(n)},h.isNull=function(n){return null===n},h.isUndefined=function(n){return n===void 0},h.has=function(n,t){return null!=n&&c.call(n,t)},h.noConflict=function(){return n._=t,this},h.identity=function(n){return n},h.constant=function(n){return function(){return n}},h.noop=function(){},h.property=function(n){return function(t){return t[n]}},h.matches=function(n){var t=h.pairs(n),r=t.length;return function(n){if(null==n)return!r;n=new Object(n);for(var e=0;r>e;e++){var u=t[e],i=u[0];if(u[1]!==n[i]||!(i in n))return!1}return!0}},h.times=function(n,t,r){var e=Array(Math.max(0,n));t=g(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},h.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},h.now=Date.now||function(){return(new Date).getTime()};var _={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},w=h.invert(_),j=function(n){var t=function(t){return n[t]},r="(?:"+h.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};h.escape=j(_),h.unescape=j(w),h.result=function(n,t){if(null==n)return void 0;var r=n[t];return h.isFunction(r)?n[t]():r};var x=0;h.uniqueId=function(n){var t=++x+"";return n?n+t:t},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/(.)^/,k={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\u2028|\u2029/g,F=function(n){return"\\"+k[n]};h.template=function(n,t,r){!t&&r&&(t=r),t=h.defaults({},t,h.templateSettings);var e=RegExp([(t.escape||A).source,(t.interpolate||A).source,(t.evaluate||A).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,a,o){return i+=n.slice(u,o).replace(O,F),u=o+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":a&&(i+="';\n"+a+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var a=new Function(t.variable||"obj","_",i)}catch(o){throw o.source=i,o}var l=function(n){return a.call(this,n,h)},c=t.variable||"obj";return l.source="function("+c+"){\n"+i+"}",l},h.chain=function(n){var t=h(n);return t._chain=!0,t};var E=function(n){return this._chain?h(n).chain():n};h.mixin=function(n){h.each(h.functions(n),function(t){var r=h[t]=n[t];h.prototype[t]=function(){var n=[this._wrapped];return i.apply(n,arguments),E.call(this,r.apply(h,n))}})},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=r[n];h.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],E.call(this,r)}}),h.each(["concat","join","slice"],function(n){var t=r[n];h.prototype[n]=function(){return E.call(this,t.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}).call(this);
6
+ //# sourceMappingURL=underscore-min.map
@@ -0,0 +1,279 @@
1
+ var appName;
2
+ var popupMask;
3
+ var popupDialog;
4
+ var clientId;
5
+ var realm;
6
+ var oauth2KeyName;
7
+ var redirect_uri;
8
+
9
+ function handleLogin() {
10
+ var scopes = [];
11
+
12
+ var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
13
+ if(auths) {
14
+ var key;
15
+ var defs = auths;
16
+ for(key in defs) {
17
+ var auth = defs[key];
18
+ if(auth.type === 'oauth2' && auth.scopes) {
19
+ oauth2KeyName = key;
20
+ var scope;
21
+ if(Array.isArray(auth.scopes)) {
22
+ // 1.2 support
23
+ var i;
24
+ for(i = 0; i < auth.scopes.length; i++) {
25
+ scopes.push(auth.scopes[i]);
26
+ }
27
+ }
28
+ else {
29
+ // 2.0 support
30
+ for(scope in auth.scopes) {
31
+ scopes.push({scope: scope, description: auth.scopes[scope]});
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ if(window.swaggerUi.api
39
+ && window.swaggerUi.api.info) {
40
+ appName = window.swaggerUi.api.info.title;
41
+ }
42
+
43
+ popupDialog = $(
44
+ [
45
+ '<div class="api-popup-dialog">',
46
+ '<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
47
+ '<div class="api-popup-content">',
48
+ '<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
49
+ '<a href="#">Learn how to use</a>',
50
+ '</p>',
51
+ '<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
52
+ '<ul class="api-popup-scopes">',
53
+ '</ul>',
54
+ '<p class="error-msg"></p>',
55
+ '<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
56
+ '</div>',
57
+ '</div>'].join(''));
58
+ $(document.body).append(popupDialog);
59
+
60
+ popup = popupDialog.find('ul.api-popup-scopes').empty();
61
+ for (i = 0; i < scopes.length; i ++) {
62
+ scope = scopes[i];
63
+ str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
64
+ if (scope.description) {
65
+ str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
66
+ }
67
+ str += '</label></li>';
68
+ popup.append(str);
69
+ }
70
+
71
+ var $win = $(window),
72
+ dw = $win.width(),
73
+ dh = $win.height(),
74
+ st = $win.scrollTop(),
75
+ dlgWd = popupDialog.outerWidth(),
76
+ dlgHt = popupDialog.outerHeight(),
77
+ top = (dh -dlgHt)/2 + st,
78
+ left = (dw - dlgWd)/2;
79
+
80
+ popupDialog.css({
81
+ top: (top < 0? 0 : top) + 'px',
82
+ left: (left < 0? 0 : left) + 'px'
83
+ });
84
+
85
+ popupDialog.find('button.api-popup-cancel').click(function() {
86
+ popupMask.hide();
87
+ popupDialog.hide();
88
+ popupDialog.empty();
89
+ popupDialog = [];
90
+ });
91
+
92
+ $('button.api-popup-authbtn').unbind();
93
+ popupDialog.find('button.api-popup-authbtn').click(function() {
94
+ popupMask.hide();
95
+ popupDialog.hide();
96
+
97
+ var authSchemes = window.swaggerUi.api.authSchemes;
98
+ var host = window.location;
99
+ var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
100
+ var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
101
+ var url = null;
102
+
103
+ for (var key in authSchemes) {
104
+ if (authSchemes.hasOwnProperty(key)) {
105
+ var flow = authSchemes[key].flow;
106
+
107
+ if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
108
+ var dets = authSchemes[key];
109
+ url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
110
+ window.swaggerUi.tokenName = dets.tokenName || 'access_token';
111
+ window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
112
+ }
113
+ else if(authSchemes[key].grantTypes) {
114
+ // 1.2 support
115
+ var o = authSchemes[key].grantTypes;
116
+ for(var t in o) {
117
+ if(o.hasOwnProperty(t) && t === 'implicit') {
118
+ var dets = o[t];
119
+ var ep = dets.loginEndpoint.url;
120
+ url = dets.loginEndpoint.url + '?response_type=token';
121
+ window.swaggerUi.tokenName = dets.tokenName;
122
+ }
123
+ else if (o.hasOwnProperty(t) && t === 'accessCode') {
124
+ var dets = o[t];
125
+ var ep = dets.tokenRequestEndpoint.url;
126
+ url = dets.tokenRequestEndpoint.url + '?response_type=code';
127
+ window.swaggerUi.tokenName = dets.tokenName;
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ var scopes = []
134
+ var o = $('.api-popup-scopes').find('input:checked');
135
+
136
+ for(k =0; k < o.length; k++) {
137
+ var scope = $(o[k]).attr('scope');
138
+
139
+ if (scopes.indexOf(scope) === -1)
140
+ scopes.push(scope);
141
+ }
142
+
143
+ window.enabledScopes=scopes;
144
+
145
+ redirect_uri = redirectUrl;
146
+
147
+ url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
148
+ url += '&realm=' + encodeURIComponent(realm);
149
+ url += '&client_id=' + encodeURIComponent(clientId);
150
+ url += '&scope=' + encodeURIComponent(scopes);
151
+
152
+ window.open(url);
153
+ });
154
+
155
+ popupMask.show();
156
+ popupDialog.show();
157
+ return;
158
+ }
159
+
160
+
161
+ function handleLogout() {
162
+ for(key in window.authorizations.authz){
163
+ window.authorizations.remove(key)
164
+ }
165
+ window.enabledScopes = null;
166
+ $('.api-ic.ic-on').addClass('ic-off');
167
+ $('.api-ic.ic-on').removeClass('ic-on');
168
+
169
+ // set the info box
170
+ $('.api-ic.ic-warning').addClass('ic-error');
171
+ $('.api-ic.ic-warning').removeClass('ic-warning');
172
+ }
173
+
174
+ function initOAuth(opts) {
175
+ var o = (opts||{});
176
+ var errors = [];
177
+
178
+ appName = (o.appName||errors.push('missing appName'));
179
+ popupMask = (o.popupMask||$('#api-common-mask'));
180
+ popupDialog = (o.popupDialog||$('.api-popup-dialog'));
181
+ clientId = (o.clientId||errors.push('missing client id'));
182
+ realm = (o.realm||errors.push('missing realm'));
183
+
184
+ if(errors.length > 0){
185
+ log('auth unable initialize oauth: ' + errors);
186
+ return;
187
+ }
188
+
189
+ $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
190
+ $('.api-ic').unbind();
191
+ $('.api-ic').click(function(s) {
192
+ if($(s.target).hasClass('ic-off'))
193
+ handleLogin();
194
+ else {
195
+ handleLogout();
196
+ }
197
+ false;
198
+ });
199
+ }
200
+
201
+ function processOAuthCode(data) {
202
+ var params = {
203
+ 'client_id': clientId,
204
+ 'code': data.code,
205
+ 'grant_type': 'authorization_code',
206
+ 'redirect_uri': redirect_uri
207
+ }
208
+ $.ajax(
209
+ {
210
+ url : window.swaggerUi.tokenUrl,
211
+ type: "POST",
212
+ data: params,
213
+ success:function(data, textStatus, jqXHR)
214
+ {
215
+ onOAuthComplete(data);
216
+ },
217
+ error: function(jqXHR, textStatus, errorThrown)
218
+ {
219
+ onOAuthComplete("");
220
+ }
221
+ });
222
+ }
223
+
224
+ function onOAuthComplete(token) {
225
+ if(token) {
226
+ if(token.error) {
227
+ var checkbox = $('input[type=checkbox],.secured')
228
+ checkbox.each(function(pos){
229
+ checkbox[pos].checked = false;
230
+ });
231
+ alert(token.error);
232
+ }
233
+ else {
234
+ var b = token[window.swaggerUi.tokenName];
235
+ if(b){
236
+ // if all roles are satisfied
237
+ var o = null;
238
+ $.each($('.auth #api_information_panel'), function(k, v) {
239
+ var children = v;
240
+ if(children && children.childNodes) {
241
+ var requiredScopes = [];
242
+ $.each((children.childNodes), function (k1, v1){
243
+ var inner = v1.innerHTML;
244
+ if(inner)
245
+ requiredScopes.push(inner);
246
+ });
247
+ var diff = [];
248
+ for(var i=0; i < requiredScopes.length; i++) {
249
+ var s = requiredScopes[i];
250
+ if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) {
251
+ diff.push(s);
252
+ }
253
+ }
254
+ if(diff.length > 0){
255
+ o = v.parentNode;
256
+ $(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
257
+ $(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
258
+
259
+ // sorry, not all scopes are satisfied
260
+ $(o).find('.api-ic').addClass('ic-warning');
261
+ $(o).find('.api-ic').removeClass('ic-error');
262
+ }
263
+ else {
264
+ o = v.parentNode;
265
+ $(o.parentNode).find('.api-ic.ic-off').addClass('ic-on');
266
+ $(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off');
267
+
268
+ // all scopes are satisfied
269
+ $(o).find('.api-ic').addClass('ic-info');
270
+ $(o).find('.api-ic').removeClass('ic-warning');
271
+ $(o).find('.api-ic').removeClass('ic-error');
272
+ }
273
+ }
274
+ });
275
+ window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
276
+ }
277
+ }
278
+ }
279
+ }
@@ -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});