mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
box sets page
This commit is contained in:
parent
317f06f607
commit
b9acc1c558
3 changed files with 225 additions and 8 deletions
|
@ -4,11 +4,74 @@
|
||||||
<title>Media Browser</title>
|
<title>Media Browser</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="boxsetsPage" data-role="page" class="page libraryPage noLogoPage" data-theme="a">
|
<div id="boxsetsPage" data-role="page" class="page libraryPage noLogoPage" data-theme="a">
|
||||||
<h1 class="libraryPageHeader"><a href="index.html" class="imageLink">
|
<h1 class="libraryPageHeader"><a href="index.html" class="imageLink">
|
||||||
<img src="css/images/home.png"></a>Movies</h1>
|
<img src="css/images/home.png"></a>Box Sets</h1>
|
||||||
<div data-role="content">
|
<div data-role="content">
|
||||||
|
<div data-role="controlgroup" data-type="horizontal" class="libraryViewNav" data-mini="true">
|
||||||
|
<a href="moviesrecommended.html" data-role="button">Recommended</a>
|
||||||
|
<a href="movies.html" data-role="button" class="ui-btn-active">Movies</a>
|
||||||
|
<a href="boxsets.html" data-role="button">Box Sets</a>
|
||||||
|
<a href="#" data-role="button">Genres</a>
|
||||||
|
<a href="#" data-role="button">Actors</a>
|
||||||
|
<a href="#" data-role="button">Directors</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="viewSettings">
|
||||||
|
<button data-mini="true" data-icon="sort" data-inline="true" onclick="$('#sortPanel', $.mobile.activePage).panel( 'toggle' );">Sort</button>
|
||||||
|
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="items"></div>
|
||||||
|
</div>
|
||||||
|
<div data-role="panel" id="sortPanel" data-position="right" data-display="overlay" data-theme="b" data-position-fixed="true">
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<div id="sortpanel">
|
||||||
|
<fieldset data-role="controlgroup">
|
||||||
|
<legend>
|
||||||
|
<h3>Sort By:</h3>
|
||||||
|
</legend>
|
||||||
|
|
||||||
|
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioSortName" value="on" checked="checked" data-sortby="SortName">
|
||||||
|
<label for="radioSortName">Name</label>
|
||||||
|
|
||||||
|
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioCommunityRating" value="off" data-sortby="CommunityRating">
|
||||||
|
<label for="radioCommunityRating">Community Rating</label>
|
||||||
|
|
||||||
|
<input class="radioSortBy" data-theme="c" type="radio" name="radioSortBy" id="radioDateCreated" value="off" data-sortby="DateCreated">
|
||||||
|
<label for="radioDateCreated">Date Added</label>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset data-role="controlgroup">
|
||||||
|
<legend>
|
||||||
|
<h3>Sort Order:</h3>
|
||||||
|
</legend>
|
||||||
|
|
||||||
|
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioAscending" value="on" checked="checked" data-sortorder="Ascending">
|
||||||
|
<label for="radioAscending">Ascending</label>
|
||||||
|
|
||||||
|
<input class="radioSortOrder" data-theme="c" type="radio" name="radioSortOrder" id="radioDescending" value="off" data-sortorder="Descending">
|
||||||
|
<label for="radioDescending">Descending</label>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div data-role="panel" id="filterPanel" data-position="right" data-display="overlay" data-theme="b" data-position-fixed="true">
|
||||||
|
<form>
|
||||||
|
<fieldset data-role="controlgroup">
|
||||||
|
<legend>
|
||||||
|
<h3>Filters:</h3>
|
||||||
|
</legend>
|
||||||
|
<input class="chkStandardFilter" type="checkbox" name="chkIsFavorite" id="chkIsFavorite" data-theme="c" data-filter="IsFavorite">
|
||||||
|
<label for="chkIsFavorite">Favorite</label>
|
||||||
|
|
||||||
|
<input class="chkStandardFilter" type="checkbox" name="chkLikes" id="chkLikes" data-theme="c" data-filter="Likes">
|
||||||
|
<label for="chkLikes">Likes</label>
|
||||||
|
|
||||||
|
<input class="chkStandardFilter" type="checkbox" name="chkDislikes" id="chkDislikes" data-theme="c" data-filter="Dislikes">
|
||||||
|
<label for="chkDislikes">Dislikes</label>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1 +1,88 @@
|
||||||
|
(function ($, document) {
|
||||||
|
|
||||||
|
// The base query options
|
||||||
|
var query = {
|
||||||
|
|
||||||
|
SortBy: "SortName",
|
||||||
|
SortOrder: "Ascending",
|
||||||
|
IncludeItemTypes: "BoxSet",
|
||||||
|
Recursive: true,
|
||||||
|
Fields: "PrimaryImageAspectRatio,ItemCounts"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function reloadItems(page) {
|
||||||
|
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
|
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||||
|
|
||||||
|
$('#items', page).html(LibraryBrowser.getBoxsetPosterViewHtml({
|
||||||
|
|
||||||
|
items: result.Items,
|
||||||
|
useAverageAspectRatio: true
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('pageinit', "#boxsetsPage", function () {
|
||||||
|
|
||||||
|
var page = this;
|
||||||
|
|
||||||
|
$('.radioSortBy', this).on('click', function () {
|
||||||
|
query.SortBy = this.getAttribute('data-sortby');
|
||||||
|
reloadItems(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.radioSortOrder', this).on('click', function () {
|
||||||
|
query.SortOrder = this.getAttribute('data-sortorder');
|
||||||
|
reloadItems(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.chkStandardFilter', this).on('change', function () {
|
||||||
|
|
||||||
|
var filterName = this.getAttribute('data-filter');
|
||||||
|
var filters = query.Filters || "";
|
||||||
|
|
||||||
|
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
||||||
|
|
||||||
|
if (this.checked) {
|
||||||
|
filters = filters ? (filters + ',' + filterName) : filterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
query.Filters = filters;
|
||||||
|
|
||||||
|
reloadItems(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on('pageshow', "#boxsetsPage", function () {
|
||||||
|
|
||||||
|
reloadItems(this);
|
||||||
|
|
||||||
|
// Reset form values using the last used query
|
||||||
|
$('.radioSortBy', this).each(function () {
|
||||||
|
|
||||||
|
this.checked = query.SortBy == this.getAttribute('data-sortby');
|
||||||
|
|
||||||
|
}).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);
|
|
@ -142,6 +142,73 @@
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getBoxsetPosterViewHtml: function (options) {
|
||||||
|
|
||||||
|
var items = options.items;
|
||||||
|
|
||||||
|
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
||||||
|
|
||||||
|
var html = "";
|
||||||
|
|
||||||
|
for (var i = 0, length = items.length; i < length; i++) {
|
||||||
|
var item = items[i];
|
||||||
|
|
||||||
|
var hasPrimaryImage = item.ImageTags && item.ImageTags.Primary;
|
||||||
|
|
||||||
|
var href = item.url || (item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id);
|
||||||
|
|
||||||
|
var showText = options.showTitle || !hasPrimaryImage || (item.Type !== 'Movie' && item.Type !== 'Series' && item.Type !== 'Season' && item.Type !== 'Trailer');
|
||||||
|
|
||||||
|
var cssClass = showText ? "posterViewItem posterViewItemWithDualText" : "posterViewItem posterViewItemWithNoText";
|
||||||
|
|
||||||
|
html += "<div class='" + cssClass + "'><a href='" + href + "'>";
|
||||||
|
|
||||||
|
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||||
|
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||||
|
type: "Backdrop",
|
||||||
|
height: 198,
|
||||||
|
width: 352,
|
||||||
|
tag: item.BackdropImageTags[0]
|
||||||
|
}) + "' />";
|
||||||
|
} else if (hasPrimaryImage) {
|
||||||
|
|
||||||
|
var height = 300;
|
||||||
|
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||||
|
|
||||||
|
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||||
|
type: "Primary",
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
tag: item.ImageTags.Primary
|
||||||
|
}) + "' />";
|
||||||
|
|
||||||
|
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||||
|
html += "<img src='" + ApiClient.getImageUrl(item.Id, {
|
||||||
|
type: "Backdrop",
|
||||||
|
height: 198,
|
||||||
|
width: 352,
|
||||||
|
tag: item.BackdropImageTags[0]
|
||||||
|
}) + "' />";
|
||||||
|
} else {
|
||||||
|
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showText) {
|
||||||
|
html += "<div class='posterViewItemText posterViewItemPrimaryText'>";
|
||||||
|
html += item.Name;
|
||||||
|
html += "</div>";
|
||||||
|
html += "<div class='posterViewItemText'>";
|
||||||
|
html += item.ChildCount+" Movie";
|
||||||
|
if (item.ChildCount > 1) html += "s";
|
||||||
|
html += "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</a></div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
},
|
||||||
|
|
||||||
getAveragePrimaryImageAspectRatio: function (items) {
|
getAveragePrimaryImageAspectRatio: function (items) {
|
||||||
|
|
||||||
var values = [];
|
var values = [];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue