-
Notifications
You must be signed in to change notification settings - Fork 278
/
schedule.mako
179 lines (168 loc) · 8.03 KB
/
schedule.mako
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<%inherit file="/layouts/main.mako"/>
<%!
from random import choice
from medusa import app
%>
<%block name="scripts">
<script type="text/javascript" src="js/ajax-episode-search.js?${sbPID}"></script>
<script>
window.app = {};
const startVue = () => {
window.app = new Vue({
el: '#vue-wrap',
store,
router,
metaInfo: {
title: 'Schedule'
},
data() {
return {
header: 'Schedule'
};
},
computed: Object.assign(
store.mapState(['shows']),
{
layout: {
get() {
const { config } = this;
return config.layout.schedule;
},
set(layout) {
const { $store } = this;
const page = 'schedule';
$store.dispatch('setLayout', { page, layout });
}
}
}
),
mounted() {
const { $store, $route } = this;
// $store.dispatch('getShows');
const unwatch = this.$watch('layout', () => {
unwatch();
const { config, layout } = this;
if (layout === 'list') {
const sortCodes = {
date: 0,
show: 2,
network: 5
};
const sort = config.comingEpsSort;
const sortList = (sort in sortCodes) ? [[sortCodes[sort], 0]] : [[0, 0]];
$('#showListTable:has(tbody tr)').tablesorter({
widgets: ['stickyHeaders', 'filter', 'columnSelector', 'saveSort'],
sortList,
textExtraction: {
0: node => $(node).find('time').attr('datetime'),
1: node => $(node).find('time').attr('datetime'),
7: node => $(node).find('span').text().toLowerCase(),
8: node => $(node).find('a[data-indexer-name]').attr('data-indexer-name')
},
headers: {
0: { sorter: 'realISODate' },
1: { sorter: 'realISODate' },
2: { sorter: 'loadingNames' },
4: { sorter: 'loadingNames' },
7: { sorter: 'quality' },
8: { sorter: 'text' },
9: { sorter: false, filter: false }
},
widgetOptions: {
filter_columnFilters: true, // eslint-disable-line camelcase
filter_hideFilters: true, // eslint-disable-line camelcase
filter_saveFilters: true, // eslint-disable-line camelcase
columnSelector_mediaquery: false // eslint-disable-line camelcase
}
});
$.ajaxEpSearch();
}
if (['banner', 'poster'].includes(layout)) {
$.ajaxEpSearch({
size: 16,
loadingImage: 'loading16' + MEDUSA.config.themeSpinner + '.gif'
});
$('.ep_summary').hide();
$('.ep_summaryTrigger').on('click', function() {
$(this).next('.ep_summary').slideToggle('normal', function() {
$(this).prev('.ep_summaryTrigger').prop('src', function(i, src) {
return $(this).next('.ep_summary').is(':visible') ? src.replace('plus', 'minus') : src.replace('minus', 'plus');
});
});
});
}
$('#popover').popover({
placement: 'bottom',
html: true, // Required if content has HTML
content: '<div id="popover-target"></div>'
}).on('shown.bs.popover', () => { // Bootstrap popover event triggered when the popover opens
// call this function to copy the column selection code into the popover
$.tablesorter.columnSelector.attachTo($('#showListTable'), '#popover-target');
});
});
}
});
};
</script>
</%block>
<%block name="content">
<% random_series = choice(results) if results else '' %>
<input type="hidden" id="background-series-slug" value="${choice(results)['series_slug'] if results else ''}" />
<div class="row">
<div class="col-md-12">
<h1 class="header">{{header}}</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="key pull-left">
<template v-if="layout !== 'calendar'">
<b>Key:</b>
<span class="listing-key listing-overdue">Missed</span>
<span class="listing-key listing-current">Today</span>
<span class="listing-key listing-default">Soon</span>
<span class="listing-key listing-toofar">Later</span>
</template>
<app-link class="btn-medusa btn-inline forceBacklog" href="webcal://${sbHost}:${sbHttpPort}/calendar">
<i class="icon-calendar icon-white"></i>Subscribe</app-link>
</div>
<div class="pull-right">
<div class="show-option">
<span>View Paused:
<select name="viewpaused" class="form-control form-control-inline input-sm" onchange="location = this.options[this.selectedIndex].value;">
<option value="schedule/toggleScheduleDisplayPaused" ${'selected="selected"' if not bool(app.COMING_EPS_DISPLAY_PAUSED) else ''}>Hidden</option>
<option value="schedule/toggleScheduleDisplayPaused" ${'selected="selected"' if app.COMING_EPS_DISPLAY_PAUSED else ''}>Shown</option>
</select>
</span>
</div>
<div class="show-option">
<span>Layout:
<select v-model="layout" name="layout" class="form-control form-control-inline input-sm">
<option value="poster" ${'selected="selected"' if app.COMING_EPS_LAYOUT == 'poster' else ''}>Poster</option>
<option value="calendar" ${'selected="selected"' if app.COMING_EPS_LAYOUT == 'calendar' else ''}>Calendar</option>
<option value="banner" ${'selected="selected"' if app.COMING_EPS_LAYOUT == 'banner' else ''}>Banner</option>
<option value="list" ${'selected="selected"' if app.COMING_EPS_LAYOUT == 'list' else ''}>List</option>
</select>
</span>
</div>
<div v-if="layout === 'list'" class="show-option">
<button id="popover" type="button" class="btn-medusa btn-inline">Select Columns <b class="caret"></b></button>
</div>
<!-- Calendar sorting is always by date -->
<div v-else-if="layout !== 'calendar'" class="show-option">
<span>Sort By:
<select name="sort" class="form-control form-control-inline input-sm" onchange="location = 'schedule/setScheduleSort/?sort=' + this.options[this.selectedIndex].value;">
<option value="date" ${'selected="selected"' if app.COMING_EPS_SORT == 'date' else ''}>Date</option>
<option value="network" ${'selected="selected"' if app.COMING_EPS_SORT == 'network' else ''}>Network</option>
<option value="show" ${'selected="selected"' if app.COMING_EPS_SORT == 'show' else ''}>Show</option>
</select>
</span>
</div>
</div>
</div>
</div>
<div class="horizontal-scroll">
<%include file="/partials/schedule/${layout}.mako"/>
</div> <!-- end horizontal scroll -->
<div class="clearfix"></div>
</%block>