Use new gateway for latest version info

This commit is contained in:
Dmitriy Simushev 2014-12-23 13:46:43 +00:00
parent 782e9895e5
commit ee751b471d
2 changed files with 18 additions and 19 deletions

View File

@ -16,26 +16,25 @@
* limitations under the License. * limitations under the License.
*/ */
(function ($) { (function (Mibew, $) {
var loadVersion = function () { Mibew.updateVersion = function(data) {
if (typeof (window.mibewLatest) == "undefined" || typeof (window.mibewLatest.version) == "undefined") { if (!data.core || !data.core.stable) {
return; return;
} }
var current = $("#current-version").html(); $(document).ready(function() {
var currentVersion = $("#current-version").html(),
core = data.core.stable;
if (current != window.mibewLatest.version) { if (currentVersion != core.version) {
if (current < window.mibewLatest.version) { if (currentVersion < core.version) {
$("#current-version").css("color", "red"); $("#current-version").css("color", "red");
}
$("#latest-version").html(core.version + ", Download <a href=\"" + core.download + "\">" + core.title + "</a>");
} else {
$("#current-version").css("color", "green");
$("#latest-version").html(core.version);
} }
$("#latest-version").html(window.mibewLatest.version + ", Download <a href=\"" + window.mibewLatest.download + "\">" + window.mibewLatest.title + "</a>"); });
} else {
$("#current-version").css("color", "green");
$("#latest-version").html(window.mibewLatest.version);
}
} }
})(Mibew, jQuery);
$(function () {
loadVersion();
});
})(jQuery);

View File

@ -47,11 +47,11 @@ class AboutController extends AbstractController
prepare_menu($this->getOperator()) prepare_menu($this->getOperator())
); );
$this->getAssetManager()->attachJs('js/compiled/about.js');
$this->getAssetManager()->attachJs( $this->getAssetManager()->attachJs(
'https://mibew.org/latestMibew.js', 'https://mibew.org/api/updates',
AssetManagerInterface::ABSOLUTE_URL AssetManagerInterface::ABSOLUTE_URL
); );
$this->getAssetManager()->attachJs('js/compiled/about.js');
return $this->render('about', $page); return $this->render('about', $page);
} }