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

#247 - Web client - Hide views that have no content

This commit is contained in:
Luke Pulverenti 2013-05-14 01:36:36 -04:00
parent aea2d1c42a
commit 443299c687
40 changed files with 267 additions and 238 deletions

View file

@ -28,6 +28,36 @@
sortBy: "SortName"
};
apiClient.getItemCounts(userId).done(function (counts) {
var views = [];
if (counts.MovieCount || counts.TrailerCount) {
views.push({ name: "Movies", url: "moviesrecommended.html", img: "css/images/items/list/chapter.png", background: "#0094FF" });
}
if (counts.EpisodeCount || counts.SeriesCount) {
views.push({ name: "TV Shows", url: "tvrecommended.html", img: "css/images/items/list/collection.png", background: "#FF870F" });
}
if (counts.SongCount) {
views.push({ name: "Music", url: "musicrecommended.html", img: "css/images/items/list/audiocollection.png", background: "#6FBD45" });
}
if (counts.GameCount) {
views.push({ name: "Games", url: "gamesrecommended.html", img: "css/images/items/list/gamecollection.png", background: "#E12026" });
}
var html = '';
for (var i = 0, length = views.length; i < length; i++) {
html += getViewHtml(views[i]);
}
$('#views', page).html(html);
});
apiClient.getItems(userId, options).done(function (result) {
$('#divCollections', page).html(LibraryBrowser.getPosterViewHtml({
@ -38,35 +68,6 @@
}));
});
// Kick this off now. Just see if there are any games in the library
var gamesPromise = ApiClient.getItems(userId, { Recursive: true, limit: 0, MediaTypes: "Game" });
var views = [
{ name: "Movies", url: "moviesrecommended.html", img: "css/images/items/list/chapter.png", background: "#0094FF" },
{ name: "TV Shows", url: "tvrecommended.html", img: "css/images/items/list/collection.png", background: "#FF870F" },
{ name: "Music", url: "musicrecommended.html", img: "css/images/items/list/audiocollection.png", background: "#6FBD45" }
];
var html = '';
for (var i = 0, length = views.length; i < length; i++) {
html += getViewHtml(views[i]);
}
$('#views', page).html(html);
gamesPromise.done(function (result) {
if (result.TotalRecordCount) {
var view = { name: "Games", url: "gamesrecommended.html", img: "css/images/items/list/gamecollection.png", background: "#E12026" };
$('#views', page).append(getViewHtml(view));
}
});
});
})(jQuery, document, ApiClient);