Add recently watched to user screen

This commit is contained in:
Tim 2015-06-21 11:21:23 +02:00
parent 6a026d510d
commit fe6d5f17f0
5 changed files with 122 additions and 20 deletions

View file

@ -189,6 +189,16 @@
<script src="interfaces/default/js/tables/user_ips.js"></script>
<script>
$(document).ready(function () {
$.ajax({
url: 'get_user_recently_watched',
async: true,
data: { user: '${user}' },
complete: function(xhr, status) {
$("#user-recently-watched").html(xhr.responseText);
}
});
history_table_options.ajax = {
"url": "get_history",
"data": function(d) {
@ -205,6 +215,7 @@
}
}
user_ip_table = $('#user_ip_table').DataTable(user_ip_table_options);
});
</script>
</%def>

View file

@ -0,0 +1,36 @@
% if recently_watched != None:
<div class="dashboard-recent-media-row">
<ul class="dashboard-recent-media">
% for item in recently_watched:
<div class="dashboard-recent-media-instance">
<li>
<div class="poster">
<div class="poster-face">
<a href="info?rating_key=${item['rating_key']}">
% if item['thumb'] != '':
<img src="pms_image_proxy?img=${item['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">
% if item['type'] == 'episode':
<h3>Season ${item['parentIndex']}, Episode ${item['index']}</h3>
% elif item['type'] == 'movie':
<h3>${item['title']} (${item['title']})</h3>
% endif
<div class="muted" id="time-${item['time']}">${item['time']}</div>
</div>
</li>
</div>
<script>
$('#time-${item['time']}').html('Watched ' + moment(${item['time']}, "X").fromNow())
</script>
% endfor
</ul>
</div>
% else:
<div class="muted">There was an error retrieving some data. Please check your <a href="config">settings</a>.</div><br>
% endif