Merge branch 'mohsen1-git-attrs' into develop_2.0

This commit is contained in:
Tony Tam
2015-03-17 16:16:37 -07:00
14 changed files with 319 additions and 316 deletions

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
* text eol=lf
dist/**/* binary

24
.gitignore vendored
View File

@@ -1,13 +1,13 @@
.DS_STORE .DS_STORE
*.ipr *.ipr
*.iml *.iml
*.iws *.iws
web/ web/
lib/*.zip lib/*.zip
version.properties version.properties
.sass-cache .sass-cache
swagger-ui.sublime-workspace swagger-ui.sublime-workspace
.idea .idea
.project .project
node_modules/* node_modules/*
/nbproject/private/ /nbproject/private/

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 979 B

View File

@@ -1,105 +1,105 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Swagger UI</title> <title>Swagger UI</title>
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" /> <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" /> <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/> <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/> <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
<link href='css/print.css' media='print' rel='stylesheet' type='text/css'/> <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
<script type="text/javascript" src="lib/shred.bundle.js"></script> <script type="text/javascript" src="lib/shred.bundle.js"></script>
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script> <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script> <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script> <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
<script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script> <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
<script src='lib/handlebars-2.0.0.js' type='text/javascript'></script> <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
<script src='lib/underscore-min.js' type='text/javascript'></script> <script src='lib/underscore-min.js' type='text/javascript'></script>
<script src='lib/backbone-min.js' type='text/javascript'></script> <script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='lib/swagger-client.js' type='text/javascript'></script> <script src='lib/swagger-client.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script> <script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script> <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<script src='lib/marked.js' type='text/javascript'></script> <script src='lib/marked.js' type='text/javascript'></script>
<!-- enabling this will enable oauth2 implicit scope support --> <!-- enabling this will enable oauth2 implicit scope support -->
<script src='lib/swagger-oauth.js' type='text/javascript'></script> <script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
var url = window.location.search.match(/url=([^&]+)/); var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) { if (url && url.length > 1) {
url = decodeURIComponent(url[1]); url = decodeURIComponent(url[1]);
} else { } else {
url = "http://petstore.swagger.io/v2/swagger.json"; url = "http://petstore.swagger.io/v2/swagger.json";
} }
window.swaggerUi = new SwaggerUi({ window.swaggerUi = new SwaggerUi({
url: url, url: url,
dom_id: "swagger-ui-container", dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
onComplete: function(swaggerApi, swaggerUi){ onComplete: function(swaggerApi, swaggerUi){
if(typeof initOAuth == "function") { if(typeof initOAuth == "function") {
/* /*
initOAuth({ initOAuth({
clientId: "your-client-id", clientId: "your-client-id",
realm: "your-realms", realm: "your-realms",
appName: "your-app-name" appName: "your-app-name"
}); });
*/ */
} }
$('pre code').each(function(i, e) { $('pre code').each(function(i, e) {
hljs.highlightBlock(e) hljs.highlightBlock(e)
}); });
}, },
onFailure: function(data) { onFailure: function(data) {
log("Unable to Load SwaggerUI"); log("Unable to Load SwaggerUI");
}, },
docExpansion: "none", docExpansion: "none",
sorter : "alpha" sorter : "alpha"
}); });
function addApiKeyAuthorization() { function addApiKeyAuthorization() {
var key = encodeURIComponent($('#input_apiKey')[0].value); var key = encodeURIComponent($('#input_apiKey')[0].value);
log("key: " + key); log("key: " + key);
if(key && key.trim() != "") { if(key && key.trim() != "") {
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query"); var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query");
window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth); window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth);
log("added key " + key); log("added key " + key);
} }
} }
$('#input_apiKey').change(addApiKeyAuthorization); $('#input_apiKey').change(addApiKeyAuthorization);
// if you have an apiKey you would like to pre-populate on the page for demonstration purposes... // if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
/* /*
var apiKey = "myApiKeyXXXX123456789"; var apiKey = "myApiKeyXXXX123456789";
$('#input_apiKey').val(apiKey); $('#input_apiKey').val(apiKey);
addApiKeyAuthorization(); addApiKeyAuthorization();
*/ */
window.swaggerUi.load(); window.swaggerUi.load();
function log() { function log() {
if ('console' in window) { if ('console' in window) {
console.log.apply(console, arguments); console.log.apply(console, arguments);
} }
} }
}); });
</script> </script>
</head> </head>
<body class="swagger-section"> <body class="swagger-section">
<div id='header'> <div id='header'>
<div class="swagger-ui-wrap"> <div class="swagger-ui-wrap">
<a id="logo" href="http://swagger.io">swagger</a> <a id="logo" href="http://swagger.io">swagger</a>
<form id='api_selector'> <form id='api_selector'>
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div> <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div> <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
<div class='input'><a id="explore" href="#">Explore</a></div> <div class='input'><a id="explore" href="#">Explore</a></div>
</form> </form>
</div> </div>
</div> </div>
<div id="message-bar" class="swagger-ui-wrap">&nbsp;</div> <div id="message-bar" class="swagger-ui-wrap">&nbsp;</div>
<div id="swagger-ui-container" class="swagger-ui-wrap"></div> <div id="swagger-ui-container" class="swagger-ui-wrap"></div>
</body> </body>
</html> </html>

View File

@@ -1,198 +1,198 @@
'use strict'; 'use strict';
$(function() { $(function() {
// Helper function for vertically aligning DOM elements // Helper function for vertically aligning DOM elements
// http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
$.fn.vAlign = function() { $.fn.vAlign = function() {
return this.each(function(){ return this.each(function(){
var ah = $(this).height(); var ah = $(this).height();
var ph = $(this).parent().height(); var ph = $(this).parent().height();
var mh = (ph - ah) / 2; var mh = (ph - ah) / 2;
$(this).css('margin-top', mh); $(this).css('margin-top', mh);
}); });
}; };
$.fn.stretchFormtasticInputWidthToParent = function() { $.fn.stretchFormtasticInputWidthToParent = function() {
return this.each(function(){ return this.each(function(){
var p_width = $(this).closest("form").innerWidth(); var p_width = $(this).closest("form").innerWidth();
var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest('form').css('padding-right'), 10); var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest('form').css('padding-right'), 10);
var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10); var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
$(this).css('width', p_width - p_padding - this_padding); $(this).css('width', p_width - p_padding - this_padding);
}); });
}; };
$('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent(); $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
// Vertically center these paragraphs // Vertically center these paragraphs
// Parent may need a min-height for this to work.. // Parent may need a min-height for this to work..
$('ul.downplayed li div.content p').vAlign(); $('ul.downplayed li div.content p').vAlign();
// When a sandbox form is submitted.. // When a sandbox form is submitted..
$("form.sandbox").submit(function(){ $("form.sandbox").submit(function(){
var error_free = true; var error_free = true;
// Cycle through the forms required inputs // Cycle through the forms required inputs
$(this).find("input.required").each(function() { $(this).find("input.required").each(function() {
// Remove any existing error styles from the input // Remove any existing error styles from the input
$(this).removeClass('error'); $(this).removeClass('error');
// Tack the error style on if the input is empty.. // Tack the error style on if the input is empty..
if ($(this).val() === '') { if ($(this).val() === '') {
$(this).addClass('error'); $(this).addClass('error');
$(this).wiggle(); $(this).wiggle();
error_free = false; error_free = false;
} }
}); });
return error_free; return error_free;
}); });
}); });
function clippyCopiedCallback() { function clippyCopiedCallback() {
$('#api_key_copied').fadeIn().delay(1000).fadeOut(); $('#api_key_copied').fadeIn().delay(1000).fadeOut();
// var b = $("#clippy_tooltip_" + a); // var b = $("#clippy_tooltip_" + a);
// b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() { // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
// b.attr("title", "copy to clipboard") // b.attr("title", "copy to clipboard")
// }, // },
// 500)) // 500))
} }
// Logging function that accounts for browsers that don't have window.console // Logging function that accounts for browsers that don't have window.console
function log(){ function log(){
log.history = log.history || []; log.history = log.history || [];
log.history.push(arguments); log.history.push(arguments);
if(this.console){ if(this.console){
console.log( Array.prototype.slice.call(arguments)[0] ); console.log( Array.prototype.slice.call(arguments)[0] );
} }
} }
// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913) // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
if (Function.prototype.bind && console && typeof console.log === "object") { if (Function.prototype.bind && console && typeof console.log === "object") {
[ [
"log","info","warn","error","assert","dir","clear","profile","profileEnd" "log","info","warn","error","assert","dir","clear","profile","profileEnd"
].forEach(function (method) { ].forEach(function (method) {
console[method] = this.bind(console[method], console); console[method] = this.bind(console[method], console);
}, Function.prototype.call); }, Function.prototype.call);
} }
window.Docs = { window.Docs = {
shebang: function() { shebang: function() {
// If shebang has an operation nickname in it.. // If shebang has an operation nickname in it..
// e.g. /docs/#!/words/get_search // e.g. /docs/#!/words/get_search
var fragments = $.param.fragment().split('/'); var fragments = $.param.fragment().split('/');
fragments.shift(); // get rid of the bang fragments.shift(); // get rid of the bang
fragments = _.map(fragments, decodeURIComponent); // decode encoded paths
switch (fragments.length) {
switch (fragments.length) { case 1:
case 1: // Expand all operations for the resource and scroll to it
// Expand all operations for the resource and scroll to it var dom_id = 'resource_' + fragments[0];
var dom_id = 'resource_' + fragments[0];
Docs.expandEndpointListForResource(fragments[0]);
Docs.expandEndpointListForResource(fragments[0]); $("#"+dom_id).slideto({highlight: false});
$('[id="' + dom_id + '"]').slideto({highlight: false}); break;
break; case 2:
case 2: // Refer to the endpoint DOM element, e.g. #words_get_search
// Refer to the endpoint DOM element, e.g. #words_get_search
// Expand Resource
// Expand Resource Docs.expandEndpointListForResource(fragments[0]);
Docs.expandEndpointListForResource(fragments[0]); $("#"+dom_id).slideto({highlight: false});
// $("#"+dom_id).slideto({highlight: false});
// Expand operation
// Expand operation var li_dom_id = fragments.join('_');
var li_dom_id = fragments.join('_'); var li_content_dom_id = li_dom_id + "_content";
var li_content_dom_id = li_dom_id + "_content";
Docs.expandOperation($('#'+li_content_dom_id));
Docs.expandOperation($('[id="' + li_content_dom_id + '"]')); $('#'+li_dom_id).slideto({highlight: false});
$('[id="' + li_dom_id + '"]').slideto({highlight: false}); break;
break; }
}
},
},
toggleEndpointListForResource: function(resource) {
toggleEndpointListForResource: function(resource) { var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints'); if (elem.is(':visible')) {
if (elem.is(':visible')) { Docs.collapseEndpointListForResource(resource);
Docs.collapseEndpointListForResource(resource); } else {
} else { Docs.expandEndpointListForResource(resource);
Docs.expandEndpointListForResource(resource); }
} },
},
// Expand resource
// Expand resource expandEndpointListForResource: function(resource) {
expandEndpointListForResource: function(resource) { var resource = Docs.escapeResourceName(resource);
var resource = Docs.escapeResourceName(resource); if (resource == '') {
if (resource == '') { $('.resource ul.endpoints').slideDown();
$('.resource ul.endpoints').slideDown(); return;
return; }
}
$('li#resource_' + resource).addClass('active');
$('li#resource_' + resource).addClass('active');
var elem = $('li#resource_' + resource + ' ul.endpoints');
var elem = $('li#resource_' + resource + ' ul.endpoints'); elem.slideDown();
elem.slideDown(); },
},
// Collapse resource and mark as explicitly closed
// Collapse resource and mark as explicitly closed collapseEndpointListForResource: function(resource) {
collapseEndpointListForResource: function(resource) { var resource = Docs.escapeResourceName(resource);
var resource = Docs.escapeResourceName(resource); if (resource == '') {
if (resource == '') { $('.resource ul.endpoints').slideUp();
$('.resource ul.endpoints').slideUp(); return;
return; }
}
$('li#resource_' + resource).removeClass('active');
$('li#resource_' + resource).removeClass('active');
var elem = $('li#resource_' + resource + ' ul.endpoints');
var elem = $('li#resource_' + resource + ' ul.endpoints'); elem.slideUp();
elem.slideUp(); },
},
expandOperationsForResource: function(resource) {
expandOperationsForResource: function(resource) { // Make sure the resource container is open..
// Make sure the resource container is open.. Docs.expandEndpointListForResource(resource);
Docs.expandEndpointListForResource(resource);
if (resource == '') {
if (resource == '') { $('.resource ul.endpoints li.operation div.content').slideDown();
$('.resource ul.endpoints li.operation div.content').slideDown(); return;
return; }
}
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { Docs.expandOperation($(this));
Docs.expandOperation($(this)); });
}); },
},
collapseOperationsForResource: function(resource) {
collapseOperationsForResource: function(resource) { // Make sure the resource container is open..
// Make sure the resource container is open.. Docs.expandEndpointListForResource(resource);
Docs.expandEndpointListForResource(resource);
if (resource == '') {
if (resource == '') { $('.resource ul.endpoints li.operation div.content').slideUp();
$('.resource ul.endpoints li.operation div.content').slideUp(); return;
return; }
}
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { Docs.collapseOperation($(this));
Docs.collapseOperation($(this)); });
}); },
},
escapeResourceName: function(resource) {
escapeResourceName: function(resource) { return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&"); },
},
expandOperation: function(elem) {
expandOperation: function(elem) { elem.slideDown();
elem.slideDown(); },
},
collapseOperation: function(elem) {
collapseOperation: function(elem) { elem.slideUp();
elem.slideUp(); }
} };
}; >>>>>>> afe232747b3d2f972d358c43688185d8fe3e7406