Browse Source

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

tags/3.0.0^2
Teknikode 10 months ago
parent
commit
f13f390ab4

+ 2
- 2
Teknik/Areas/Stats/Views/Stats/Index.cshtml 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)

+ 2
- 2
Teknik/Areas/User/Views/User/ViewServiceData.cshtml 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">

+ 11
- 0
Teknik/Scripts/Stats/Stats.js View File

@@ -9,6 +9,17 @@ $(document).ready(function () {
$('#oneTime-section').collapse('hide');
$('#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

+ 11
- 0
Teknik/Scripts/User/ViewServiceData.js 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) {

+ 0
- 12
Teknik/Scripts/common.js 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');

Loading…
Cancel
Save