update tv studios, tv genres

This commit is contained in:
Luke Pulverenti 2016-04-23 14:40:36 -04:00
parent 728a6c4631
commit 1caad9ae47
2 changed files with 30 additions and 56 deletions

View File

@ -17,8 +17,7 @@
IncludeItemTypes: "Series",
Recursive: true,
Fields: "DateCreated,SyncInfo,ItemCounts",
StartIndex: 0,
Limit: LibraryBrowser.getDefaultPageSize()
StartIndex: 0
},
view: LibraryBrowser.getSavedView(key) || LibraryBrowser.getDefaultItemsView('Thumb', 'Thumb')
};
@ -46,23 +45,9 @@
ApiClient.getGenres(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0);
var html = '';
var viewStyle = getPageData().view;
$('.listTopPaging', context).html(LibraryBrowser.getQueryPagingHtml({
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
viewButton: false,
showLimit: false,
updatePageSizeSetting: false,
addLayoutButton: true,
currentLayout: viewStyle
}));
var viewStyle = self.getCurrentViewStyle();
if (viewStyle == "Thumb") {
html = LibraryBrowser.getPosterViewHtml({
@ -116,30 +101,40 @@
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
$('.btnNextPage', context).on('click', function () {
query.StartIndex += query.Limit;
reloadItems(context);
});
$('.btnPreviousPage', context).on('click', function () {
query.StartIndex -= query.Limit;
reloadItems(context);
});
$('.btnChangeLayout', context).on('layoutchange', function (e, layout) {
getPageData().view = layout;
LibraryBrowser.saveViewSetting(getSavedQueryKey(), layout);
reloadItems(context);
});
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
Dashboard.hideLoadingMsg();
});
}
self.renderTab = function () {
self.getViewStyles = function () {
return 'Poster,PosterCard,Thumb,ThumbCard'.split(',');
};
self.getCurrentViewStyle = function () {
return getPageData(tabContent).view;
};
self.setCurrentViewStyle = function(viewStyle) {
getPageData(tabContent).view = viewStyle;
LibraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
reloadItems(tabContent);
};
self.enableViewSelection = true;
self.renderTab = function () {
reloadItems(tabContent);
};
tabContent.querySelector('.btnSelectView').addEventListener('click', function (e) {
LibraryBrowser.showLayoutMenu(e.target, self.getCurrentViewStyle(), self.getViewStyles());
});
tabContent.querySelector('.btnSelectView').addEventListener('layoutchange', function (e) {
self.setCurrentViewStyle(e.detail.viewStyle);
});
};
});

View File

@ -16,8 +16,7 @@
IncludeItemTypes: "Series",
Recursive: true,
Fields: "DateCreated,ItemCounts",
StartIndex: 0,
Limit: LibraryBrowser.getDefaultPageSize()
StartIndex: 0
}
};
@ -40,18 +39,8 @@
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0);
var html = '';
$('.listTopPaging', context).html(LibraryBrowser.getQueryPagingHtml({
startIndex: query.StartIndex,
limit: query.Limit,
totalRecordCount: result.TotalRecordCount,
showLimit: false
}));
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
@ -68,16 +57,6 @@
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
$('.btnNextPage', context).on('click', function () {
query.StartIndex += query.Limit;
reloadItems(context, params);
});
$('.btnPreviousPage', context).on('click', function () {
query.StartIndex -= query.Limit;
reloadItems(context, params);
});
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
Dashboard.hideLoadingMsg();
});