mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 16:44:11 +03:00
Attach js on updates page via controller
This commit is contained in:
parent
d01bd8a080
commit
54b4814389
@ -16,38 +16,40 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function loadNews() {
|
||||
if (typeof(window.mibewNews) == "undefined" || typeof(window.mibewNews.length) == "undefined") {
|
||||
return;
|
||||
(function ($) {
|
||||
var loadNews = function () {
|
||||
if (typeof (window.mibewNews) == "undefined" || typeof (window.mibewNews.length) == "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
var str = "<div>";
|
||||
for (var i = 0; i < window.mibewNews.length; i++) {
|
||||
str += "<div class=\"news-title\"><a hre" + "f=\"" + window.mibewNews[i].link + "\">" + window.mibewNews[i].title + "</a>, <span class=\"small\">" + window.mibewNews[i].date + "</span></div>";
|
||||
str += "<div class=\"news-text\">" + window.mibewNews[i].message + "</div>";
|
||||
}
|
||||
$("#news").html(str + "</div>");
|
||||
}
|
||||
|
||||
var str = "<div>";
|
||||
for (var i = 0; i < window.mibewNews.length; i++) {
|
||||
str += "<div class=\"newstitle\"><a hre" + "f=\"" + window.mibewNews[i].link + "\">" + window.mibewNews[i].title + "</a>, <span class=\"small\">" + window.mibewNews[i].date + "</span></div>";
|
||||
str += "<div class=\"newstext\">" + window.mibewNews[i].message+"</div>";
|
||||
}
|
||||
$("#news").html(str + "</div>");
|
||||
}
|
||||
var loadVersion = function () {
|
||||
if (typeof (window.mibewLatest) == "undefined" || typeof (window.mibewLatest.version) == "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
function loadVersion() {
|
||||
if(typeof(window.mibewLatest) == "undefined" || typeof(window.mibewLatest.version) == "undefined") {
|
||||
return;
|
||||
var current = $("#current-version").html();
|
||||
|
||||
if (current != window.mibewLatest.version) {
|
||||
if (current < window.mibewLatest.version) {
|
||||
$("#current-version").css("color", "red");
|
||||
}
|
||||
$("#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);
|
||||
}
|
||||
}
|
||||
|
||||
var current = $("#cver").html();
|
||||
|
||||
if(current != window.mibewLatest.version) {
|
||||
if(current < window.mibewLatest.version) {
|
||||
$("#cver").css("color","red");
|
||||
}
|
||||
$("#lver").html(window.mibewLatest.version+", Download <a href=\""+window.mibewLatest.download+"\">"+window.mibewLatest.title+"</a>");
|
||||
} else {
|
||||
$("#cver").css("color","green");
|
||||
$("#lver").html(window.mibewLatest.version);
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
loadNews();
|
||||
loadVersion();
|
||||
});
|
||||
$(function () {
|
||||
loadNews();
|
||||
loadVersion();
|
||||
});
|
||||
})(jQuery);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
namespace Mibew\Controller;
|
||||
|
||||
use Mibew\Asset\AssetManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
@ -57,6 +58,12 @@ class UpdatesController extends AbstractController
|
||||
|
||||
$page = array_merge($page, prepare_menu($operator));
|
||||
|
||||
$this->getAssetManager()->attachJs(
|
||||
'https://mibew.org/latestMibew.js',
|
||||
AssetManagerInterface::ABSOLUTE_URL
|
||||
);
|
||||
$this->getAssetManager()->attachJs('js/compiled/update.js');
|
||||
|
||||
return $this->render('updates', $page);
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ table.awaiting .no-threads, table.awaiting .no-visitors {
|
||||
padding:4px;
|
||||
}
|
||||
|
||||
.newstext {
|
||||
.news-text {
|
||||
margin-bottom:1em;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
{{#extends "_layout"}}
|
||||
{{#override "menu"}}{{> _menu}}{{/override}}
|
||||
|
||||
{{#override "head"}}
|
||||
<script type="text/javascript" language="javascript" src="http://mibew.org/latestMibew.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="{{asset "js/compiled/update.js"}}"></script>
|
||||
{{/override}}
|
||||
|
||||
{{#override "content"}}
|
||||
{{l10n "Messenger updates."}}
|
||||
|
||||
@ -23,12 +18,12 @@
|
||||
<div id="news"></div>
|
||||
|
||||
{{l10n "You are using:"}}<br/>
|
||||
<div id="cver">{{version}}</div>
|
||||
<div id="current-version">{{version}}</div>
|
||||
|
||||
<br/>
|
||||
|
||||
{{l10n "Latest version:"}}
|
||||
<div id="lver"></div>
|
||||
<div id="latest-version"></div>
|
||||
|
||||
<br/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user