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

fix other music tabs

This commit is contained in:
Luke Pulverenti 2016-07-30 14:09:08 -04:00
parent 98b3a231d1
commit ad32dca3dd
3 changed files with 49 additions and 7 deletions

View file

@ -98,7 +98,7 @@
<button is="paper-icon-button-light" class="btnFilter autoSize" title="${ButtonFilter}"><i class="md-icon">filter_list</i></button> <button is="paper-icon-button-light" class="btnFilter autoSize" title="${ButtonFilter}"><i class="md-icon">filter_list</i></button>
</div> </div>
<div is="emby-itemscontainer" id="items" class="itemsContainer" style="max-width:1000px;margin: 0 auto;"></div> <div is="emby-itemscontainer" id="items" class="itemsContainer vertical-list" style="max-width:1000px;margin: 0 auto;"></div>
<div style="text-align: center; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;padding:.7em .5em;"> <div style="text-align: center; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;padding:.7em .5em;">
<div class="paging"></div> <div class="paging"></div>

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView', 'emby-itemscontainer'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView', 'cardBuilder', 'emby-itemscontainer'], function (events, libraryBrowser, imageLoader, alphaPicker, listView, cardBuilder) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -46,6 +46,25 @@
return context.savedQueryKey; return context.savedQueryKey;
} }
function onViewStyleChange() {
var viewStyle = self.getCurrentViewStyle();
var itemsContainer = tabContent.querySelector('.itemsContainer');
if (viewStyle == "List") {
itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap');
}
else {
itemsContainer.classList.remove('vertical-list');
itemsContainer.classList.add('vertical-wrap');
}
itemsContainer.innerHTML = '';
}
function reloadItems(page) { function reloadItems(page) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
@ -83,7 +102,7 @@
} }
else if (viewStyle == "PosterCard") { else if (viewStyle == "PosterCard") {
html = libraryBrowser.getPosterViewHtml({ html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "square", shape: "square",
context: 'music', context: 'music',
@ -97,7 +116,7 @@
else { else {
// Poster // Poster
html = libraryBrowser.getPosterViewHtml({ html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "square", shape: "square",
context: 'music', context: 'music',
@ -237,6 +256,7 @@
getPageData(tabContent).view = viewStyle; getPageData(tabContent).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle); libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
getQuery(tabContent).StartIndex = 0; getQuery(tabContent).StartIndex = 0;
onViewStyleChange();
reloadItems(tabContent); reloadItems(tabContent);
}); });
} }
@ -246,6 +266,7 @@
}; };
initPage(tabContent); initPage(tabContent);
onViewStyleChange();
self.renderTab = function () { self.renderTab = function () {

View file

@ -1,4 +1,4 @@
define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView', 'emby-itemscontainer'], function (events, libraryBrowser, imageLoader, alphaPicker, listView) { define(['events', 'libraryBrowser', 'imageLoader', 'alphaPicker', 'listView', 'cardBuilder', 'emby-itemscontainer'], function (events, libraryBrowser, imageLoader, alphaPicker, listView, cardBuilder) {
return function (view, params, tabContent) { return function (view, params, tabContent) {
@ -44,6 +44,25 @@
return context.savedQueryKey; return context.savedQueryKey;
} }
function onViewStyleChange() {
var viewStyle = self.getCurrentViewStyle();
var itemsContainer = tabContent.querySelector('.itemsContainer');
if (viewStyle == "List") {
itemsContainer.classList.add('vertical-list');
itemsContainer.classList.remove('vertical-wrap');
}
else {
itemsContainer.classList.remove('vertical-list');
itemsContainer.classList.add('vertical-wrap');
}
itemsContainer.innerHTML = '';
}
function reloadItems(page) { function reloadItems(page) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
@ -84,7 +103,7 @@
} }
else if (viewStyle == "PosterCard") { else if (viewStyle == "PosterCard") {
html = LibraryBrowser.getPosterViewHtml({ html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "square", shape: "square",
context: 'music', context: 'music',
@ -98,7 +117,7 @@
else { else {
// Poster // Poster
html = LibraryBrowser.getPosterViewHtml({ html = cardBuilder.getCardsHtml({
items: result.Items, items: result.Items,
shape: "square", shape: "square",
context: 'music', context: 'music',
@ -203,6 +222,7 @@
getPageData(tabContent).view = viewStyle; getPageData(tabContent).view = viewStyle;
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle); libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
getQuery(tabContent).StartIndex = 0; getQuery(tabContent).StartIndex = 0;
onViewStyleChange();
reloadItems(tabContent); reloadItems(tabContent);
}); });
} }
@ -212,6 +232,7 @@
}; };
initPage(tabContent); initPage(tabContent);
onViewStyleChange();
self.renderTab = function () { self.renderTab = function () {