1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

added series status filter

This commit is contained in:
Luke Pulverenti 2013-04-09 08:31:43 -04:00
parent 72a4598a2e
commit 282f3a31c9
3 changed files with 135 additions and 100 deletions

View file

@ -52,7 +52,7 @@
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />"; html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
} }
else if (item.MediaType == "Video") { else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/video.png' />"; html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/video.png' />";
} }

View file

@ -1,159 +1,184 @@
(function ($, document) { (function ($, document) {
// The base query options // The base query options
var query = { var query = {
SortBy: "SortName", SortBy: "SortName",
SortOrder: "Ascending", SortOrder: "Ascending",
IncludeItemTypes: "Series", IncludeItemTypes: "Series",
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio,SeriesInfo" Fields: "PrimaryImageAspectRatio,SeriesInfo"
}; };
function getTableHtml(items) { function getTableHtml(items) {
var html = '<div class="libraryItemsGridContainer"><table data-role="table" data-mode="reflow" class="ui-responsive table-stroke libraryItemsGrid">'; var html = '<div class="libraryItemsGridContainer"><table data-role="table" data-mode="reflow" class="ui-responsive table-stroke libraryItemsGrid">';
html += '<thead>'; html += '<thead>';
html += '<tr>'; html += '<tr>';
html += '<th>&nbsp;</th>'; html += '<th>&nbsp;</th>';
html += '<th>Name</th>'; html += '<th>Name</th>';
html += '<th>Year</th>'; html += '<th>Year</th>';
html += '<th>Official Rating</th>'; html += '<th>Official Rating</th>';
html += '<th>Runtime</th>'; html += '<th>Runtime</th>';
html += '<th>Community Rating</th>'; html += '<th>Community Rating</th>';
html += '</tr>'; html += '</tr>';
html += '</thead>'; html += '</thead>';
html += '<tbody>'; html += '<tbody>';
for (var i = 0, length = items.length; i < length; i++) { for (var i = 0, length = items.length; i < length; i++) {
html += getRowHtml(items[i]); html += getRowHtml(items[i]);
} }
html += '</tbody>'; html += '</tbody>';
html += '</table></div>'; html += '</table></div>';
return html; return html;
} }
function getRowHtml(item) { function getRowHtml(item) {
var html = '<tr>'; var html = '<tr>';
html += '<td>'; html += '<td>';
var url = "itemdetails.html?id=" + item.Id; var url = "itemdetails.html?id=" + item.Id;
var imageTags = item.ImageTags; var imageTags = item.ImageTags;
html += '<a href="' + url + '">'; html += '<a href="' + url + '">';
if (imageTags.Primary) { if (imageTags.Primary) {
html += '<img class="libraryGridImage" src="' + ApiClient.getImageUrl(item.Id, { html += '<img class="libraryGridImage" src="' + ApiClient.getImageUrl(item.Id, {
type: "Primary", type: "Primary",
height: 150, height: 150,
tag: item.ImageTags.Primary tag: item.ImageTags.Primary
}) + '" />'; }) + '" />';
} }
else { else {
html += '<img class="libraryGridImage" style="background:' + LibraryBrowser.getMetroColor(item.Id) + ';" src="css/images/items/list/collection.png" />'; html += '<img class="libraryGridImage" style="background:' + LibraryBrowser.getMetroColor(item.Id) + ';" src="css/images/items/list/collection.png" />';
} }
html += '</a></td>'; html += '</a></td>';
html += '<td><a href="' + url + '">' + item.Name + '</a></td>'; html += '<td><a href="' + url + '">' + item.Name + '</a></td>';
html += '<td>' + (item.ProductionYear || "") + '</td>'; html += '<td>' + (item.ProductionYear || "") + '</td>';
html += '<td>' + (item.OfficialRating || "") + '</td>'; html += '<td>' + (item.OfficialRating || "") + '</td>';
html += '<td>' + (item.RunTimeTicks || "") + '</td>'; html += '<td>' + (item.RunTimeTicks || "") + '</td>';
html += '<td>' + (item.CommunityRating || "") + '</td>'; html += '<td>' + (item.CommunityRating || "") + '</td>';
html += '</tr>'; html += '</tr>';
return html; return html;
} }
function reloadItems(page) { function reloadItems(page) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
$('#items', page).html(LibraryBrowser.getPosterViewHtml({ $('#items', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items, items: result.Items,
useAverageAspectRatio: true useAverageAspectRatio: true
}))/*.html(getTableHtml(result.Items)).trigger('create')*/; }))/*.html(getTableHtml(result.Items)).trigger('create')*/;
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
} }
$(document).on('pageinit', "#tvShowsPage", function () { $(document).on('pageinit', "#tvShowsPage", function () {
var page = this; var page = this;
$('.radioSortBy', this).on('click', function () { $('.radioSortBy', this).on('click', function () {
query.SortBy = this.getAttribute('data-sortby'); query.SortBy = this.getAttribute('data-sortby');
reloadItems(page); reloadItems(page);
}); });
$('.radioSortOrder', this).on('click', function () { $('.radioSortOrder', this).on('click', function () {
query.SortOrder = this.getAttribute('data-sortorder'); query.SortOrder = this.getAttribute('data-sortorder');
reloadItems(page); reloadItems(page);
}); });
$('.chkStandardFilter', this).on('change', function () { $('.chkStandardFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter'); var filterName = this.getAttribute('data-filter');
var filters = query.Filters || ""; var filters = query.Filters || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1); filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) { if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName; filters = filters ? (filters + ',' + filterName) : filterName;
} }
query.Filters = filters; query.Filters = filters;
reloadItems(page); reloadItems(page);
}); });
}).on('pagebeforeshow', "#tvShowsPage", function () { $('.chkStatus', this).on('change', function () {
reloadItems(this); var filterName = this.getAttribute('data-filter');
var filters = query.SeriesStatus || "";
}).on('pageshow', "#tvShowsPage", function () { filters = (',' + filters).replace(',' + filterName, '').substring(1);
// Reset form values using the last used query if (this.checked) {
$('.radioSortBy', this).each(function () { filters = filters ? (filters + ',' + filterName) : filterName;
}
this.checked = query.SortBy == this.getAttribute('data-sortby'); query.SeriesStatus = filters;
}).checkboxradio('refresh'); reloadItems(page);
});
$('.radioSortOrder', this).each(function () { }).on('pagebeforeshow', "#tvShowsPage", function () {
this.checked = query.SortOrder == this.getAttribute('data-sortorder'); reloadItems(this);
}).checkboxradio('refresh'); }).on('pageshow', "#tvShowsPage", function () {
$('.chkStandardFilter', this).each(function () { // Reset form values using the last used query
$('.radioSortBy', this).each(function () {
var filters = "," + (query.Filters || ""); this.checked = query.SortBy == this.getAttribute('data-sortby');
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1; }).checkboxradio('refresh');
}).checkboxradio('refresh'); $('.chkStatus', this).each(function () {
});
var filters = "," + (query.SeriesStatus || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('.radioSortOrder', this).each(function () {
this.checked = query.SortOrder == this.getAttribute('data-sortorder');
}).checkboxradio('refresh');
$('.chkStandardFilter', this).each(function () {
var filters = "," + (query.Filters || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
});
})(jQuery, document); })(jQuery, document);

View file

@ -74,6 +74,16 @@
<input class="chkStandardFilter" type="checkbox" name="chkDislikes" id="chkDislikes" data-theme="c" data-filter="Dislikes"> <input class="chkStandardFilter" type="checkbox" name="chkDislikes" id="chkDislikes" data-theme="c" data-filter="Dislikes">
<label for="chkDislikes">Dislikes</label> <label for="chkDislikes">Dislikes</label>
</fieldset> </fieldset>
<fieldset data-role="controlgroup">
<legend>
<h3>Status:</h3>
</legend>
<input class="chkStatus" type="checkbox" name="chkStatusContinuing" id="chkStatusContinuing" data-theme="c" data-filter="Continuing">
<label for="chkStatusContinuing">Continuing</label>
<input class="chkStatus" type="checkbox" name="chkStatusEnded" id="chkStatusEnded" data-theme="c" data-filter="Ended">
<label for="chkStatusEnded">Ended</label>
</fieldset>
</form> </form>
</div> </div>
</div> </div>