diff --git a/dist/css/screen.css b/dist/css/screen.css index 32b199b1..7bec5505 100644 --- a/dist/css/screen.css +++ b/dist/css/screen.css @@ -1254,3 +1254,9 @@ text-align: center; padding-top: 10px; } +.swagger-section .swagger-collapse:before { + content: "-"; +} +.swagger-section .swagger-expand:before { + content: "+"; +} diff --git a/dist/images/collapse.gif b/dist/images/collapse.gif new file mode 100644 index 00000000..8843e8ce Binary files /dev/null and b/dist/images/collapse.gif differ diff --git a/dist/images/expand.gif b/dist/images/expand.gif new file mode 100644 index 00000000..477bf137 Binary files /dev/null and b/dist/images/expand.gif differ diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js index 3a67772a..1802b7ab 100644 --- a/dist/swagger-ui.js +++ b/dist/swagger-ui.js @@ -65,6 +65,16 @@ window.SwaggerUi = Backbone.Router.extend({ this.headerView.on('update-swagger-ui', function(data) { return that.updateSwaggerUi(data); }); + + // JSon Editor custom theming + JSONEditor.defaults.iconlibs.swagger = JSONEditor.AbstractIconLib.extend({ + mapping: { + collapse: 'collapse', + expand: 'expand' + }, + icon_prefix: 'swagger-' + }); + }, // Set an option after initializing @@ -21567,7 +21577,11 @@ SwaggerUi.Views.ParameterView = Backbone.View.extend({ this.model.jsonEditor = /* global JSONEditor */ new JSONEditor($('.editor_holder', $self)[0], - {schema: this.model.schema, startval : this.model.default, ajax:true, disable_properties:true, disable_edit_json:true }); + {schema: this.model.schema, startval : this.model.default, + ajax:true, + disable_properties:true, + disable_edit_json:true, + iconlib: 'swagger' }); // This is so that the signature can send back the sample to the json editor // TODO: SignatureView should expose an event "onSampleClicked" instead signatureModel.jsonEditor = this.model.jsonEditor; diff --git a/dist/swagger-ui.min.js b/dist/swagger-ui.min.js index 4d2060e5..6f6c4942 100644 --- a/dist/swagger-ui.min.js +++ b/dist/swagger-ui.min.js @@ -1,12 +1,11 @@ -(function(){"use strict";function e(){e.history=e.history||[],e.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])}window.SwaggerUi=Backbone.Router.extend({dom_id:"swagger_ui",options:null,api:null,headerView:null,mainView:null,initialize:function(e){e=e||{},e.dom_id&&(this.dom_id=e.dom_id,delete e.dom_id),e.supportedSubmitMethods||(e.supportedSubmitMethods=["get","put","post","delete","head","options","patch"]),"string"==typeof e.oauth2RedirectUrl&&(window.oAuthRedirectUrl=e.redirectUrl),$("#"+this.dom_id).length||$("body").append('
'),this.options=e,marked.setOptions({gfm:!0});var t=this;this.options.success=function(){return t.render()},this.options.progress=function(e){return t.showMessage(e)},this.options.failure=function(e){return t.onLoadFailure(e)},this.headerView=new SwaggerUi.Views.HeaderView({el:$("#header")}),this.headerView.on("update-swagger-ui",function(e){return t.updateSwaggerUi(e)})},setOption:function(e,t){this.options[e]=t},getOption:function(e){return this.options[e]},updateSwaggerUi:function(e){this.options.url=e.url,this.load()},load:function(){this.mainView&&this.mainView.clear();var e=this.options.url;e&&0!==e.indexOf("http")&&(e=this.buildUrl(window.location.href.toString(),e)),this.options.url=e,this.headerView.update(e),this.api=new SwaggerClient(this.options)},collapseAll:function(){Docs.collapseEndpointListForResource("")},listAll:function(){Docs.collapseOperationsForResource("")},expandAll:function(){Docs.expandOperationsForResource("")},render:function(){switch(this.showMessage("Finished Loading Resource Information. Rendering Swagger UI..."),this.mainView=new SwaggerUi.Views.MainView({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options,router:this}).render(),this.showMessage(),this.options.docExpansion){case"full":this.expandAll();break;case"list":this.listAll()}this.renderGFM(),this.options.onComplete&&this.options.onComplete(this.api,this),setTimeout(Docs.shebang.bind(this),100)},buildUrl:function(e,t){if(0===t.indexOf("/")){var n=e.split("/");return e=n[0]+"//"+n[2],e+t}var r=e.length;return e.indexOf("?")>-1&&(r=Math.min(r,e.indexOf("?"))),e.indexOf("#")>-1&&(r=Math.min(r,e.indexOf("#"))),e=e.substring(0,r),-1!==e.indexOf("/",e.length-1)?e+t:e+"/"+t},showMessage:function(e){void 0===e&&(e=""),$("#message-bar").removeClass("message-fail"),$("#message-bar").addClass("message-success"),$("#message-bar").html(e)},onLoadFailure:function(e){void 0===e&&(e=""),$("#message-bar").removeClass("message-success"),$("#message-bar").addClass("message-fail");var t=$("#message-bar").html(e);return this.options.onFailure&&this.options.onFailure(e),t},renderGFM:function(){$(".markdown").each(function(){$(this).html(marked($(this).html()))})}}),window.SwaggerUi.Views={},function(){function e(e){"console"in window&&"function"==typeof window.console.warn&&console.warn(e)}window.authorizations={add:function(){if(e("Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add()."),"undefined"==typeof window.swaggerUi)throw new TypeError("window.swaggerUi is not defined");window.swaggerUi instanceof SwaggerUi&&window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations,arguments)}},window.ApiKeyAuthorization=function(){e("window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization."),SwaggerClient.ApiKeyAuthorization.apply(window,arguments)},window.PasswordAuthorization=function(){e("window.PasswordAuthorization is deprecated. Please use SwaggerClient.PasswordAuthorization."),SwaggerClient.PasswordAuthorization.apply(window,arguments)}}(),function(e,t){"function"==typeof define&&define.amd?define(["b"],function(n){return e.SwaggerUi=t(n)}):"object"==typeof exports?module.exports=t(require("b")):e.SwaggerUi=t(e.b)}(this,function(){return SwaggerUi}),this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,r){var i,o="function",a=t.helperMissing,s=this.escapeExpression;return"\n