mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Implement new home page stats (still needs styling)
This commit is contained in:
parent
9364b06c99
commit
112d5f0efa
4 changed files with 267 additions and 1 deletions
67
data/interfaces/default/home_stats.html
Normal file
67
data/interfaces/default/home_stats.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
% if stats[0]['rows']:
|
||||
<div class="dashboard-recent-media-row">
|
||||
<ul class="dashboard-recent-media">
|
||||
% for a in stats:
|
||||
<div class="dashboard-recent-media-instance">
|
||||
% if a['stat_id'] == 'top_tv':
|
||||
<li>
|
||||
<div class="poster">
|
||||
<h5>Most watched TV</h5><br/>
|
||||
<div class="poster-face">
|
||||
<a href="info?rating_key=${a['rows'][0]['rating_key']}">
|
||||
% if a['rows'][0]['grandparent_thumb'] != '':
|
||||
<img src="pms_image_proxy?img=${a['rows'][0]['grandparent_thumb']}&width=153&height=225" class="poster-face">
|
||||
% else:
|
||||
<img src="interfaces/default/images/poster.png" class="poster-face">
|
||||
% endif
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dashboard-recent-media-metacontainer">
|
||||
<h3>${a['rows'][0]['orig_title']}</h3>
|
||||
<div class="muted">Plays: ${a['rows'][0]['total_plays']}</div>
|
||||
</div>
|
||||
</li>
|
||||
% elif a['stat_id'] == 'top_users':
|
||||
<li>
|
||||
<div class="poster">
|
||||
<h5>Most active user</h5><br/>
|
||||
<div class="poster-face">
|
||||
<a href="user?user=${a['rows'][0]['user']}">
|
||||
% if a['rows'][0]['thumb'] != '':
|
||||
<img src="${a['rows'][0]['thumb']}" class="poster-face">
|
||||
% else:
|
||||
<img src="interfaces/default/images/gravatar-default.png" class="poster-face">
|
||||
% endif
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dashboard-recent-media-metacontainer">
|
||||
<h3>${a['rows'][0]['user']}</h3>
|
||||
<div class="muted">Plays: ${a['rows'][0]['total_plays']}</div>
|
||||
</div>
|
||||
</li>
|
||||
% elif a['stat_id'] == 'top_platforms':
|
||||
<li>
|
||||
<div class="poster">
|
||||
<h5>Most used platform</h5><br/>
|
||||
<div class="poster-face" id="platform-face">
|
||||
<img src="interfaces/default/images/platforms/default.png" class="poster-face">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dashboard-recent-media-metacontainer">
|
||||
<h3>${a['rows'][0]['platform_type']}</h3>
|
||||
<div class="muted">Plays: ${a['rows'][0]['total_plays']}</div>
|
||||
</div>
|
||||
</li>
|
||||
<script>
|
||||
$("#platform-face").html("<img class='user-platforms-instance-poster' src='" + getPlatformImagePath('${a['rows'][0]['platform_type']}') + "'>");
|
||||
</script>
|
||||
% endif
|
||||
</div>
|
||||
% endfor
|
||||
</ul>
|
||||
</div>
|
||||
% else:
|
||||
<div class="muted">No stats for selected period.</div><br>
|
||||
% endif
|
|
@ -26,6 +26,24 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="wellbg">
|
||||
<div class="wellheader">
|
||||
<div class="dashboard-wellheader">
|
||||
<h3>Statistics
|
||||
<span class="muted"> | <a href="javascript:void(0)" id="stats-7">7 days</a></span>
|
||||
<span class="muted"> | <a href="javascript:void(0)" id="stats-30">30 days</a></span>
|
||||
<span class="muted"> | <a href="javascript:void(0)" id="stats-90">90 days</a></span>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div id="home-stats">
|
||||
<div class='muted'><i class="fa fa-refresh fa-spin"></i> Loading stats...</div><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row-fluid'>
|
||||
<div class='wellbg'>
|
||||
<div class='wellheader'>
|
||||
|
@ -45,6 +63,19 @@
|
|||
<%def name="javascriptIncludes()">
|
||||
<script src="interfaces/default/js/moment-with-locale.js"></script>
|
||||
<script>
|
||||
|
||||
function getHomeStats(days) {
|
||||
$.ajax({
|
||||
url: 'home_stats',
|
||||
cache: false,
|
||||
async: true,
|
||||
data: {time_range: days},
|
||||
complete: function(xhr, status) {
|
||||
$("#home-stats").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function currentActivity() {
|
||||
$.ajax({
|
||||
url: 'get_current_activity',
|
||||
|
@ -97,6 +128,24 @@
|
|||
recentlyAdded();
|
||||
});
|
||||
});
|
||||
|
||||
getHomeStats(7);
|
||||
|
||||
$('#stats-7').click(function() {
|
||||
$('#home-stats').html('<div class="muted"><i class="fa fa-refresh fa-spin"></i> Loading stats...</div><br>');
|
||||
getHomeStats(7);
|
||||
});
|
||||
|
||||
$('#stats-30').click(function() {
|
||||
$('#home-stats').html('<div class="muted"><i class="fa fa-refresh fa-spin"></i> Loading stats...</div><br>');
|
||||
getHomeStats(30);
|
||||
});
|
||||
|
||||
$('#stats-90').click(function() {
|
||||
$('#home-stats').html('<div class="muted"><i class="fa fa-refresh fa-spin"></i> Loading stats...</div><br>');
|
||||
getHomeStats(90);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</%def>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue