mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-05 02:43:37 +00:00
ccb9bb329c
Change Coming Episodes to "Episodes" page (API endpoint is not renamed). Add coming episodes to episode view renaming to config migration code. Change Layout term "Calender" to "Day by Day" on Episodes page. Fix saving of sort modes to config file on Episodes page. Add qTip episode plots to "Day by Day" on Episodes page. Add article sorting to networks on Episodes page. Add toggle sort direction and multidimensional sort to isotope on Episodes page. Add text "[paused]" where appropriate to shows on layout Day by Day. Simplified sort code in webserver and in template. Change page auto refresh from 10 to 30 mins. Add other UI tweaks.
170 lines
5.6 KiB
Cheetah
170 lines
5.6 KiB
Cheetah
#import sickbeard
|
|
#import datetime
|
|
#import re
|
|
#import urllib
|
|
#from sickbeard.common import *
|
|
#from sickbeard import sbdatetime
|
|
#from sickbeard.helpers import anon_url
|
|
|
|
#set global $title='Trending Shows'
|
|
#set global $header='Trending Shows'
|
|
|
|
#set global $sbPath='..'
|
|
|
|
#set global $topmenu='episodeView'
|
|
#import os.path
|
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
|
|
|
|
<script type="text/javascript" src="$sbRoot/js/plotTooltip.js?$sbPID"></script>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
<!--
|
|
|
|
\$(document).ready(function(){
|
|
// initialise combos for dirty page refreshes
|
|
\$('#showsort').val('original');
|
|
\$('#showsortdirection').val('asc');
|
|
\$('#showfilter').val('*');
|
|
|
|
var \$container = [\$('#container')];
|
|
jQuery.each(\$container, function (j) {
|
|
this.isotope({
|
|
itemSelector: '.trakt_show',
|
|
sortBy: 'original-order',
|
|
layoutMode: 'fitRows',
|
|
getSortData: {
|
|
name: function( itemElem ) {
|
|
var name = \$( itemElem ).attr('data-name') || '';
|
|
#if not $sickbeard.SORT_ARTICLE:
|
|
name = name.replace(/^(?:(?:A(?!\s+to)n?)|The)\s(\w)/i, '$1');
|
|
#end if
|
|
return name.toLowerCase();
|
|
},
|
|
rating: '[data-rating] parseInt',
|
|
votes: '[data-votes] parseInt',
|
|
}
|
|
});
|
|
});
|
|
|
|
\$('#showsort').on( 'change', function() {
|
|
var sortCriteria;
|
|
switch (this.value) {
|
|
case 'original':
|
|
sortCriteria = 'original-order'
|
|
break;
|
|
case 'rating':
|
|
/* randomise, else the rating_votes can already
|
|
* have sorted leaving this with nothing to do.
|
|
*/
|
|
\$('#container').isotope({sortBy: 'random'});
|
|
sortCriteria = 'rating';
|
|
break;
|
|
case 'rating_votes':
|
|
sortCriteria = ['rating', 'votes'];
|
|
break;
|
|
case 'votes':
|
|
sortCriteria = 'votes';
|
|
break;
|
|
default:
|
|
sortCriteria = 'name'
|
|
break;
|
|
}
|
|
\$('#container').isotope({sortBy: sortCriteria});
|
|
});
|
|
|
|
\$('#showsortdirection').on( 'change', function() {
|
|
\$('#container').isotope({sortAscending: ('asc' == this.value)});
|
|
});
|
|
|
|
\$('#showfilter').on( 'change', function() {
|
|
var filterValue = this.value;
|
|
\$('#container').isotope({ filter: filterValue });
|
|
});
|
|
});
|
|
|
|
//-->
|
|
</script>
|
|
|
|
#if $varExists('header')
|
|
<h1 class="header">$header</h1>
|
|
#else
|
|
<h1 class="title">$title</h1>
|
|
#end if
|
|
|
|
#if $trending_shows
|
|
<div class="pull-right" style="margin-top: -40px;">
|
|
<span>Show:</span>
|
|
<select id="showfilter" class="form-control form-control-inline input-sm">
|
|
#set $count_trending = len($trending_shows)
|
|
#set $count_inlibrary = $trending_inlibrary
|
|
<option value="*" selected="selected">All<%= ' (%d)' % count_trending %></option>
|
|
<option value=".notinlibrary">Not In Library<%= ' (%d)' % (count_trending - count_inlibrary) %></option>
|
|
<option value=".inlibrary">In Library<%= ' (%d)' % count_inlibrary %></option>
|
|
</select>
|
|
|
|
<span style="margin-left:12px">Sort By:</span>
|
|
<select id="showsort" class="form-control form-control-inline input-sm">
|
|
<option value="name">Name</option>
|
|
<option value="original" selected="selected">Original</option>
|
|
<option value="votes">Votes</option>
|
|
<option value="rating">% Rating</option>
|
|
<option value="rating_votes">% Rating > Votes</option>
|
|
</select>
|
|
|
|
<span style="margin-left:12px">Sort Order:</span>
|
|
<select id="showsortdirection" class="form-control form-control-inline input-sm">
|
|
<option value="asc" selected="selected">Asc</option>
|
|
<option value="desc">Desc</option>
|
|
</select>
|
|
</div>
|
|
#end if
|
|
|
|
<div id="container">
|
|
|
|
#if None is $trending_shows
|
|
<div class="trakt_show" style="width:100%; margin-top:20px">
|
|
<p class="red-text">Trakt API did not return results, this can happen from time to time.
|
|
<br /><br />This view should auto refresh every 10 mins.</p>
|
|
</div>
|
|
#else
|
|
#for $cur_show in $trending_shows:
|
|
|
|
#set $image = re.sub(r'(.*)/original/(.+)$', r'\1/thumb/\2', $cur_show['images']['poster'], 0, re.IGNORECASE | re.MULTILINE)
|
|
|
|
<div class="trakt_show <%= ('notinlibrary', 'inlibrary')[':' in cur_show['show_id']] %>" data-name="$cur_show['title']" data-rating="$cur_show['ratings']['percentage']" data-votes="$cur_show['ratings']['votes']">
|
|
<div class="traktContainer">
|
|
<div class="trakt-image">
|
|
<a class="trakt-image" href="<%= anon_url(cur_show['url']) %>" target="_blank"><img alt="" class="trakt-image" src="${image}" /></a>
|
|
</div>
|
|
|
|
<div class="show-title">
|
|
<%= (cur_show['title'], '<span> </span>')[ '' == cur_show['title']] %>
|
|
</div>
|
|
|
|
<div class="clearfix">
|
|
<p>$cur_show['ratings']['percentage']% <img src="$sbRoot/images/heart.png"></p>
|
|
<i>$cur_show['ratings']['votes'] votes</i>
|
|
|
|
<div class="traktShowTitleIcons">
|
|
#if ':' in $cur_show['show_id']:
|
|
<p style="line-height: 1.5; padding: 2px 5px 3px" title="<%= '%s added' % ('TVRage', 'theTVDB')['1' == cur_show['show_id'][:1]] %>">In library</p>
|
|
#else
|
|
#set $encoded_show_title = urllib.quote($cur_show['title'].encode("utf-8"))
|
|
<a href="$sbRoot/home/addTraktShow?indexer_id=${cur_show['show_id']}&showName=${encoded_show_title}" class="btn btn-xs">Add Show</a>
|
|
#end if
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
#end for
|
|
#end if
|
|
</div>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
<!--
|
|
window.setInterval('location.reload(true)', 600000); // Refresh every 10 minutes
|
|
//-->
|
|
</script>
|
|
|
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
|