added library grouping settings.

This commit is contained in:
Luke Pulverenti 2014-06-04 22:32:40 -04:00
parent dc1da009b3
commit d0f7690950
9 changed files with 80 additions and 30 deletions

View File

@ -204,7 +204,6 @@
.musicViewMenu {
background-image: url(images/items/folders/music.png);
background-position: 14px 8px;
}
.homeViewMenu {

View File

@ -15,7 +15,7 @@
<div data-role="content">
<div class="ui-bar-b readOnlyContent welcomeMessage" style="display: none; padding: 2em; border-radius: 10px; margin: 1em auto; font-weight: normal;">
<div class="ui-bar-b readOnlyContent welcomeMessage" style="display: none; padding: 2em; border-radius: 10px; margin: 2em auto; font-weight: normal;">
<h1 style="margin-top: 0;">${HeaderWelcomeToMediaBrowserWebClient}</h1>
<p>${MessageLearnHowToCustomize}</p>
<p>

View File

@ -14,6 +14,22 @@
<br />
<form class="displayPreferencesForm" style="margin: 0 auto;">
<div class="detailSectionHeader" style="margin: 0 .5em;">
${HeaderLibraryViews}
</div>
<div style="margin: 0 1em;">
<p>${LabelSelectFolderGroups}</p>
<div class="folderGroupList"></div>
<div class="fieldDescription">${LabelSelectFolderGroupsHelp}</div>
</div>
<br />
<br />
<div class="detailSectionHeader" style="margin: 0 .5em;">
${HeaderOtherDisplaySettings}
</div>
<ul data-role="listview" class="ulForm">
<li>
<input type="checkbox" id="chkDisplayMissingEpisodes" data-mini="true" />

View File

@ -102,13 +102,7 @@
function loadlibraryButtons(elem, userId, index) {
var options = {
SortBy: "SortName",
Fields: "PrimaryImageAspectRatio"
};
var promise1 = ApiClient.getItems(userId, options);
var promise1 = ApiClient.getUserViews(userId);
var promise2 = ApiClient.getLiveTvInfo();
@ -210,13 +204,7 @@
function loadLibraryTiles(elem, userId) {
var options = {
SortBy: "SortName",
Fields: "PrimaryImageAspectRatio"
};
ApiClient.getItems(userId, options).done(function (result) {
ApiClient.getUserViews(userId).done(function (result) {
var html = '';
@ -338,11 +326,13 @@
});
}
var homePageDismissValue = '2';
function dismissWelcome(page, userId) {
ApiClient.getDisplayPreferences('home', userId, 'webclient').done(function (result) {
result.CustomPrefs.homePageWelcomeDismissed = '1';
result.CustomPrefs.homePageWelcomeDismissed = homePageDismissValue;
ApiClient.updateDisplayPreferences('home', result, userId, 'webclient').done(function() {
$('.welcomeMessage', page).hide();
@ -369,7 +359,7 @@
ApiClient.getDisplayPreferences('home', userId, 'webclient').done(function (result) {
if (result.CustomPrefs.homePageWelcomeDismissed) {
if (result.CustomPrefs.homePageWelcomeDismissed == homePageDismissValue) {
$('.welcomeMessage', page).hide();
} else {
$('.welcomeMessage', page).show();

View File

@ -97,11 +97,7 @@
var userId = Dashboard.getCurrentUserId();
ApiClient.getItems(userId, {
SortBy: "SortName"
}).done(function (result) {
ApiClient.getUserViews(userId).done(function (result) {
var items = result.Items;

View File

@ -80,8 +80,7 @@
userId: Dashboard.getCurrentUserId(),
categoryLimit: screenWidth >= 1200 ? 6 : 3,
itemLimit: screenWidth >= 1920 ? 8 : (screenWidth >= 1440 ? 8 : 6),
Fields: "PrimaryImageAspectRatio",
ParentId: parentId
Fields: "PrimaryImageAspectRatio"
});
$.getJSON(url).done(function (recommendations) {

View File

@ -215,7 +215,7 @@
}).on('pagebeforeshow', "#musicVideosPage", function () {
//query.ParentId = LibraryMenu.getTopParentId();
query.ParentId = LibraryMenu.getTopParentId();
var limit = LibraryBrowser.getDefaultPageSize();

View File

@ -7,7 +7,35 @@
$('#chkGroupMoviesIntoCollections', page).checked(user.Configuration.GroupMoviesIntoBoxSets || false).checkboxradio("refresh");
ApiClient.getItems(user.Id, {}).done(function (result) {
var folderHtml = '';
folderHtml += '<div data-role="controlgroup">';
folderHtml += result.Items.map(function (i) {
var currentHtml = '';
var id = 'chkGroupFolder' + i.Id;
currentHtml += '<label for="' + id + '">' + i.Name + '</label>';
var isChecked = user.Configuration.ExcludeFoldersFromGrouping.indexOf(i.Id) == -1;
var checkedHtml = isChecked ? ' checked="checked"' : '';
currentHtml += '<input class="chkGroupFolder" data-folderid="' + i.Id + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedHtml + ' />';
return currentHtml;
}).join('');
folderHtml += '</div>';
$('.folderGroupList', page).html(folderHtml).trigger('create');
Dashboard.hideLoadingMsg();
});
}
function saveUser(page, user) {
@ -16,6 +44,11 @@
user.Configuration.DisplayUnairedEpisodes = $('#chkDisplayUnairedEpisodes', page).checked();
user.Configuration.GroupMoviesIntoBoxSets = $('#chkGroupMoviesIntoCollections', page).checked();
user.Configuration.ExcludeFoldersFromGrouping = $(".chkGroupFolder:not(:checked)", page).get().map(function (i) {
return i.getAttribute('data-folderid');
});
ApiClient.updateUser(user).done(function () {
Dashboard.alert(Globalize.translate('SettingsSaved'));
});

View File

@ -2552,6 +2552,23 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
});
};
self.getUserViews = function (userId, options) {
if (!userId) {
throw new Error("null userId");
}
options = options || {};
var url = self.getUrl("Users/" + userId + "/Views", options);
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
/**
Gets artists from an item
*/