save web client view selection

This commit is contained in:
Luke Pulverenti 2014-01-13 11:25:18 -05:00
parent 71271abcb1
commit 14a7a42256
9 changed files with 67 additions and 24 deletions

View File

@ -1,7 +1,5 @@
(function ($, document) {
var view = "Poster";
// The base query options
var query = {

View File

@ -1,8 +1,6 @@
(function ($, document) {
var view = "Poster";
// The base query options
var query = {

View File

@ -178,6 +178,8 @@
view = this.value;
reloadItems(page);
LibraryBrowser.saveViewSetting(getParameterByName('parentId'), view);
});
$('#btnEdit', page).on('click', function () {
@ -201,6 +203,8 @@
}).on('pageshow', "#itemListPage", function () {
var page = this;
query.Limit = LibraryBrowser.getDefaultPageSize();
query.ParentId = getParameterByName('parentId');
query.Filters = "";
@ -209,11 +213,19 @@
query.StartIndex = 0;
query.NameStartsWithOrGreater = '';
LibraryBrowser.loadSavedQueryValues(getParameterByName('parentId'), query);
var key = getParameterByName('parentId');
LibraryBrowser.loadSavedQueryValues(key, query);
reloadItems(this);
LibraryBrowser.getSavedViewSetting(key).done(function (val) {
updateFilterControls(this);
if (val) {
$('#selectView', page).val(val).selectmenu('refresh').trigger('change');
} else {
reloadItems(page);
}
});
updateFilterControls(page);
}).on('pagehide', "#itemListPage", function () {

View File

@ -46,6 +46,20 @@
localStorage.setItem(key + '_' + Dashboard.getCurrentUserId(), JSON.stringify(values));
},
saveViewSetting: function(key, value) {
localStorage.setItem(key + '_' + Dashboard.getCurrentUserId() + '_view', value);
},
getSavedViewSetting: function (key) {
var deferred = $.Deferred();
var val = localStorage.getItem(key + '_' + Dashboard.getCurrentUserId() + '_view');
deferred.resolveWith(null, [val]);
return deferred.promise();
},
getDateParamValue: function (date) {
function formatDigit(i) {

View File

@ -212,6 +212,7 @@
reloadItems(page);
}
LibraryBrowser.saveViewSetting('movies', view);
});
$('#chk3D', this).on('change', function () {
@ -346,6 +347,7 @@
}).on('pagebeforeshow', "#moviesPage", function () {
var page = this;
var limit = LibraryBrowser.getDefaultPageSize();
// If the default page size has changed, the start index will have to be reset
@ -356,7 +358,14 @@
LibraryBrowser.loadSavedQueryValues('movies', query);
reloadItems(this);
LibraryBrowser.getSavedViewSetting('movies').done(function (val) {
if (val) {
$('#selectView', page).val(val).selectmenu('refresh').trigger('change');
} else {
reloadItems(page);
}
});
}).on('pageshow', "#moviesPage", function () {

View File

@ -1,7 +1,5 @@
(function ($, document) {
var view = "Poster";
// The base query options
var query = {
@ -31,7 +29,6 @@
var checkSortOption = $('.radioSortBy:checked', page);
$('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
if (view == "Poster") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "portrait",
@ -39,7 +36,6 @@
useAverageAspectRatio: true,
showTitle: true
});
}
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);

View File

@ -165,6 +165,7 @@
} else {
reloadItems(page);
}
LibraryBrowser.saveViewSetting('musicalbums', view);
});
$('.alphabetPicker', page).on('alphaselect', function (e, character) {
@ -191,6 +192,7 @@
}).on('pagebeforeshow', "#musicAlbumsPage", function () {
var page = this;
var limit = LibraryBrowser.getDefaultPageSize();
// If the default page size has changed, the start index will have to be reset
@ -201,7 +203,14 @@
LibraryBrowser.loadSavedQueryValues('musicalbums', query);
reloadItems(this);
LibraryBrowser.getSavedViewSetting('musicalbums').done(function (val) {
if (val) {
$('#selectView', page).val(val).selectmenu('refresh').trigger('change');
} else {
reloadItems(page);
}
});
}).on('pageshow', "#musicAlbumsPage", function () {

View File

@ -1,7 +1,5 @@
(function ($, document) {
var view = "Poster";
// The base query options
var query = {

View File

@ -233,6 +233,7 @@
} else {
reloadItems(page);
}
LibraryBrowser.saveViewSetting('tvshows', view);
});
$('#chkTrailer', this).on('change', function () {
@ -335,6 +336,7 @@
}).on('pagebeforeshow', "#tvShowsPage", function () {
var page = this;
var limit = LibraryBrowser.getDefaultPageSize();
// If the default page size has changed, the start index will have to be reset
@ -345,7 +347,14 @@
LibraryBrowser.loadSavedQueryValues('tvshows', query);
reloadItems(this);
LibraryBrowser.getSavedViewSetting('tvshows').done(function (val) {
if (val) {
$('#selectView', page).val(val).selectmenu('refresh').trigger('change');
} else {
reloadItems(page);
}
});
}).on('pageshow', "#tvShowsPage", function () {