diff --git a/dist/lang/en.js b/dist/lang/en.js
index 4c32ab9e..a7356d9c 100644
--- a/dist/lang/en.js
+++ b/dist/lang/en.js
@@ -35,4 +35,17 @@ SwaggerTranslator.learn({this._swaggerLang = {
"See more at":"See more at",
"Contact the developer":"Contact the developer",
"api version":"api version",
+ "Response Content Type":"Response Content Type",
+ "fetching resource":"fetching resource",
+ "fetching resource list":"fetching resource list",
+ "Explore":"Explore",
+ "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis",
+ "Show Wordnik Developer Apis":"Show Wordnik Developer Apis",
+ "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.",
+ "Please specify the protocol for":"Please specify the protocol for",
+ "Can't read swagger JSON from":"Can't read swagger JSON from",
+ "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI",
+ "Unable to read api":"Unable to read api",
+ "from path":"from path",
+ "server returned":"server returned"
});
\ No newline at end of file
diff --git a/dist/lang/ru.js b/dist/lang/ru.js
index 07dd46fa..65dda864 100644
--- a/dist/lang/ru.js
+++ b/dist/lang/ru.js
@@ -33,5 +33,19 @@ SwaggerTranslator.learn({
"Created by":"Разработано",
"See more at":"Еще тут",
"Contact the developer":"Связаться с разработчиком",
- "api version":"Версия API"
+ "api version":"Версия API",
+ "Response Content Type":"Content Type ответа",
+ "fetching resource":"Получение ресурса",
+ "fetching resource list":"Получение ресурсов",
+ "Explore":"Поехали",
+ "Show Swagger Petstore Example Apis":"Показать примеры АПИ",
+ "Show Wordnik Developer Apis":"Показать АПИ Wordnik Developer",
+ "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, какая-то лажа с настройками доступа",
+ "Please specify the protocol for":"Пожалуйста, укажите протогол для",
+ "Can't read swagger JSON from":"Не получается прочитать swagger json из",
+ "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим",
+ "Unable to read api":"Не удалось прочитать api",
+ "from path":"по адресу",
+ "server returned":"сервер сказал"
+
});
\ No newline at end of file
diff --git a/dist/lang/translator.js b/dist/lang/translator.js
index c46b30bd..eabb5731 100644
--- a/dist/lang/translator.js
+++ b/dist/lang/translator.js
@@ -5,20 +5,10 @@
* after .
* For example -
*
- * Then you should create a SwaggerUI object this way:
- * new SwaggerUi({
- * ....
- * onComplete: function(swaggerApi, swaggerUi){
- * SwaggerTranslator.translate();
- * ....
- * }
- * })
- * in your index.html.
- *
* If you wish to translate some new texsts you should do two things:
- * 1. Add new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too.
+ * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too.
* 2. Mark that text it templates this way New Phrase or .
- * The main thing here is attribute data-swTarnslate. Only inner html and value-attribute are going to translate.
+ * The main thing here is attribute data-swTarnslate. Only inner html, title-attribute and value-attribute are going to translate.
*
*/
SwaggerTranslator = {
@@ -35,6 +25,10 @@ SwaggerTranslator = {
$(this).val(
$this._tryTranslate($(this).val())
);
+ $(this).attr(
+ 'title',
+ $this._tryTranslate($(this).attr('title'))
+ );
}
)
},
diff --git a/dist/lib/swagger-client.js b/dist/lib/swagger-client.js
index eac794f1..cf036396 100644
--- a/dist/lib/swagger-client.js
+++ b/dist/lib/swagger-client.js
@@ -291,13 +291,14 @@ var SwaggerClient = function(url, options) {
this.isValid = false;
this.info = null;
this.useJQuery = false;
+ this.resourceCount = 0;
if(typeof url !== 'undefined')
return this.initialize(url, options);
};
SwaggerClient.prototype.initialize = function (url, options) {
- this.models = models;
+ this.models = models = {};
options = (options||{});
@@ -338,7 +339,7 @@ SwaggerClient.prototype.initialize = function (url, options) {
SwaggerClient.prototype.build = function(mock) {
if (this.isBuilt) return this;
var self = this;
- this.progress('fetching resource list: ' + this.url);
+ this.progress('fetching resource list: ' + this.url);
var obj = {
useJQuery: this.useJQuery,
url: this.url,
@@ -349,11 +350,11 @@ SwaggerClient.prototype.build = function(mock) {
on: {
error: function(response) {
if (self.url.substring(0, 4) !== 'http')
- return self.fail('Please specify the protocol for ' + self.url);
+ return self.fail('Please specify the protocol for ' + self.url);
else if (response.status === 0)
- return self.fail('Can\'t read from server. It may not have the appropriate access-control-origin settings.');
+ return self.fail('Can\'t read from server. It may not have the appropriate access-control-origin settings.');
else if (response.status === 404)
- return self.fail('Can\'t read swagger JSON from ' + self.url);
+ return self.fail('Can\'t read swagger JSON from ' + self.url);
else
return self.fail(response.status + ' : ' + response.statusText + ' ' + self.url);
},
@@ -1569,6 +1570,7 @@ SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
this.apisArray.push(res);
} else {
var k;
+ this.expectedResourceCount = response.apis.length;
for (k = 0; k < response.apis.length; k++) {
var resource = response.apis[k];
res = new SwaggerResource(resource, this);
@@ -1577,12 +1579,17 @@ SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
}
}
this.isValid = true;
- if (typeof this.success === 'function') {
- this.success();
- }
return this;
};
+SwaggerClient.prototype.finish = function() {
+ if (typeof this.success === 'function') {
+ console.log('success');
+ this.selfReflect();
+ this.success();
+ }
+}
+
SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
log('This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info');
if (response.apiVersion != null)
@@ -1702,7 +1709,7 @@ var SwaggerResource = function (resourceObj, api) {
this.operations = {};
this.operationsArray = [];
this.modelsArray = [];
- this.models = {};
+ this.models = api.models || {};
this.rawModels = {};
this.useJQuery = (typeof api.useJQuery !== 'undefined') ? api.useJQuery : null;
@@ -1717,7 +1724,7 @@ var SwaggerResource = function (resourceObj, api) {
} else {
this.url = this.api.basePath + this.path.replace('{format}', 'json');
}
- this.api.progress('fetching resource ' + this.name + ': ' + this.url);
+ this.api.progress('fetching resource ' + this.name + ': ' + this.url);
var obj = {
url: this.url,
method: 'GET',
@@ -1728,11 +1735,13 @@ var SwaggerResource = function (resourceObj, api) {
on: {
response: function (resp) {
var responseObj = resp.obj || JSON.parse(resp.data);
+ _this.api.resourceCount += 1;
return _this.addApiDeclaration(responseObj);
},
error: function (response) {
- return _this.api.fail('Unable to read api \'' +
- _this.name + '\' from path ' + _this.url + ' (server returned ' + response.statusText + ')');
+ _this.api.resourceCount += 1;
+ return _this.api.fail('Unable to read api \'' +
+ _this.name + '\' from path ' + _this.url + ' (server returned ' + response.statusText + ')');
}
}
};
@@ -1784,7 +1793,9 @@ SwaggerResource.prototype.addApiDeclaration = function (response) {
}
this.api[this.name] = this;
this.ready = true;
- return this.api.selfReflect();
+ if(this.api.resourceCount === this.api.expectedResourceCount)
+ this.api.finish();
+ return this;
};
SwaggerResource.prototype.addModels = function (models) {
diff --git a/dist/swagger-ui.js b/dist/swagger-ui.js
index fa44b5c9..4169bd07 100644
--- a/dist/swagger-ui.js
+++ b/dist/swagger-ui.js
@@ -212,7 +212,7 @@ this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"co
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return "\n
\n\n";
+ + "\n \n \n \n\n\n";
},"useData":true});
var SwaggerUi,
__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; },
@@ -289,6 +289,7 @@ SwaggerUi = (function(_super) {
};
SwaggerUi.prototype.load = function() {
+ console.log(0)
var url, _ref;
if ((_ref = this.mainView) != null) {
_ref.clear();
@@ -300,7 +301,8 @@ SwaggerUi = (function(_super) {
this.options.url = url;
this.headerView.update(url);
this.api = new SwaggerClient(this.options);
- return this.api.build();
+
+ return this.api;
};
SwaggerUi.prototype.collapseAll = function() {
@@ -316,7 +318,7 @@ SwaggerUi = (function(_super) {
};
SwaggerUi.prototype.render = function() {
- this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
+ this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
this.mainView = new MainView({
model: this.api,
el: $('#' + this.dom_id),
@@ -331,6 +333,11 @@ SwaggerUi = (function(_super) {
this.listAll();
}
this.renderGFM();
+
+ if (typeof SwaggerTranslator != 'undefined') {
+ SwaggerTranslator.translate();
+ }
+
if (this.options.onComplete) {
this.options.onComplete(this.api, this);
}
@@ -369,7 +376,14 @@ SwaggerUi = (function(_super) {
}
$('#message-bar').removeClass('message-fail');
$('#message-bar').addClass('message-success');
- return $('#message-bar').html(data);
+
+ var result = $('#message-bar').html(data);
+
+ if (typeof SwaggerTranslator != 'undefined') {
+ SwaggerTranslator.translate();
+ }
+
+ return result;
};
SwaggerUi.prototype.onLoadFailure = function(data) {
@@ -383,6 +397,12 @@ SwaggerUi = (function(_super) {
if (this.options.onFailure != null) {
this.options.onFailure(data);
}
+
+ if (typeof SwaggerTranslator != 'undefined') {
+ SwaggerTranslator.translate();
+ }
+
+
return val;
};
@@ -407,7 +427,7 @@ Handlebars.registerHelper('sanitize', function(html) {
});
this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
- return "\n\n\n";
+ return "\n\n\n";
},"useData":true});
var ApiKeyButton,
__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; },
@@ -566,15 +586,15 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
return "";
+ + "\" data-swTarnslate='1'>Terms of service";
},"4":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
- return "Created by "
+ return "
Created by "
+ escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
+ "
";
},"6":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
- return "
";
+ + "\" data-swTarnslate='1'>Contact the developer
";
},"10":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
return "