1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Issue #101 - Fixed stats and service data tabs not initially loading and remembering your selection.

This commit is contained in:
Uncled1023 2019-01-23 20:09:39 -08:00
parent f8c5c739d8
commit f13f390ab4
5 changed files with 26 additions and 16 deletions

View File

@ -14,13 +14,13 @@
@if (Config.StatsConfig.Enabled)
{
<ul class="nav nav-tabs" role="tablist">
<li role="presentation"><a href="#site-stats" role="tab" data-toggle="tab">Site Statistics</a></li>
<li role="presentation" class="active"><a href="#site-stats" role="tab" data-toggle="tab">Site Statistics</a></li>
<li role="presentation"><a href="#transactions" role="tab" data-toggle="tab">Transactions</a></li>
<li role="presentation"><a href="#takedowns" role="tab" data-toggle="tab">Takedowns</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane" id="site-stats">
<div role="tabpanel" class="tab-pane active" id="site-stats">
<h2 class="text-center"><b>Site Statistics</b></h2>
<hr>
@if (Config.PiwikConfig.Enabled)

View File

@ -11,13 +11,13 @@
<div class="row">
<div class="col-sm-12">
<ul class="nav nav-tabs" id="myTab">
<li><a href="#uploads" data-toggle="tab"> Uploads </a></li>
<li class="active"><a href="#uploads" data-toggle="tab"> Uploads </a></li>
<li><a href="#pastes" data-toggle="tab"> Pastes </a></li>
<li><a href="#shortenedUrls" data-toggle="tab"> Shortened Urls </a></li>
<li><a href="#vaults" data-toggle="tab"> Vaults </a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="uploads">
<div class="tab-pane active" id="uploads">
@foreach (Teknik.Areas.Upload.Models.Upload upload in Model.Uploads)
{
<div class="panel panel-default" id="@upload.Url">

View File

@ -10,6 +10,17 @@ $(document).ready(function () {
$('#donations-section').collapse('hide');
$('#takedowns-section').collapse('hide');
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
// save the latest tab; use cookies if you like 'em better:
localStorage.setItem('lastTab_stats', $(this).attr('href'));
});
// go to the latest tab, if it exists:
var lastTab = localStorage.getItem('lastTab_stats');
if (lastTab) {
$('a[href="' + lastTab + '"]').tab('show');
}
///* ----------------------------------------
// CPU Usage
//-----------------------------------------*/

View File

@ -23,6 +23,17 @@ $(document).ready(function () {
var element = $('#vaults [id="' + id + '"');
deleteItem(deleteVaultURL, id, element, "Are you sure you want to delete this vault?");
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
// save the latest tab; use cookies if you like 'em better:
localStorage.setItem('lastTab_serviceData', $(this).attr('href'));
});
// go to the latest tab, if it exists:
var lastTab = localStorage.getItem('lastTab_serviceData');
if (lastTab) {
$('a[href="' + lastTab + '"]').tab('show');
}
});
function deleteItem(url, id, element, confirmationMsg) {

View File

@ -67,18 +67,6 @@ $(function () {
e.stopPropagation();
});
// for bootstrap 3 use 'shown.bs.tab', for bootstrap 2 use 'shown' in the next line
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
// save the latest tab; use cookies if you like 'em better:
localStorage.setItem('lastTab', $(this).attr('href'));
});
// go to the latest tab, if it exists:
var lastTab = localStorage.getItem('lastTab');
if (lastTab) {
$('[href="' + lastTab + '"]').tab('show');
}
// Auo-select bitcoin address
$('#bitcoin_address_footer').click(function() {
SelectAll('bitcoin_address_footer');