Skip to content

Commit

Permalink
add the current version in the admin dashboard
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Andrés <[email protected]>
  • Loading branch information
DiegoAndresCortes committed Nov 1, 2020
1 parent ba264df commit ac3bc65
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
15 changes: 15 additions & 0 deletions Sources/Shop/Manage/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ public function main()
$context['Shop']['support'] = Shop::$supportSite;
$context['Shop']['credits'] = $this->credits();

// Load the currrent version for this mod
loadJavaScriptFile('https://smftricks.com/assets/version/Shop/version.js', ['external' => true]);

// Feed news
addInlineJavascript('
$(function(){
Expand Down Expand Up @@ -268,6 +271,18 @@ public function main()
},
error: function (html){}
});
if (window.st_mod_version)
{
var shopversion = document.getElementById("lastestVersion");
if (window.st_mod_version != "' . Shop::$version . '")
{
setInnerHTML(yourVersion, "<i style=\"color:red\">" + \'' . Shop::$version . '\' + "</i> " + \'' . Shop::getText('version_outdated') . '\');
}
setInnerHTML(lastestVersion, window.st_mod_version);
}
});
', true);
}
Expand Down
7 changes: 4 additions & 3 deletions Themes/default/Shop/ShopAdmin.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ function template_dashboard()
<div class="windowbg nopadding">
<div class="content padding">
<div id="version_details">
<strong>', $txt['support_versions'], ':</strong><br />
', $txt['Shop_version'] , ':
<em id="yourVersion" style="white-space: nowrap;">', $context['Shop']['version'] , '</em><br />
<strong>', $txt['Shop_version'], ':</strong>
<span id="yourVersion" style="white-space: nowrap;">', $context['Shop']['version'] , '</span><br />
<strong>', $txt['Shop_current_version'], ':</strong>
<span id="lastestVersion" style="white-space: nowrap;"></span><br />
</div>
</div>
<div class="title_bar">
Expand Down
2 changes: 2 additions & 0 deletions Themes/default/languages/Shop/ShopAdmin.english.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
$txt['Shop_live_news'] = 'Live from smftricks.com';
$txt['Shop_live_error'] = 'Couldn\'t connect to smftricks.com';
$txt['Shop_version'] = 'Shop version';
$txt['Shop_current_version'] = 'Current version';
$txt['Shop_version_outdated'] = 'Your shop version is not up to date!';
$txt['Shop_donate_title'] = 'Donate to the author';
$txt['Shop_tab_info'] = 'Shop Information';
$txt['Shop_tab_info_desc'] = 'Hello %s, welcome to your ST Shop Admin panel. From here you can edit the shop settings, add items, modules, categories and set the reward in the games room.<br> Additionally you can check the shop logs adn use the maintenance tools to restock items or send items/money to specific users, or remove items from their inventory.';
Expand Down

0 comments on commit ac3bc65

Please sign in to comment.