added user view setting

This commit is contained in:
Luke Pulverenti 2015-04-15 17:59:20 -04:00
parent 8a3440f594
commit ddc966d515
2 changed files with 57 additions and 4 deletions

View File

@ -27,7 +27,7 @@
<div class="fieldDescription">${LabelSelectFolderGroupsHelp}</div>
</div>
<br />
<div>
<div data-role="controlgroup">
<label for="chkDisplayCollectionView">${LabelDisplayCollectionsView}</label>
@ -35,7 +35,7 @@
</div>
<div class="fieldDescription">${LabelDisplayCollectionsViewHelp}</div>
</div>
<br />
<div data-role="controlgroup">
<label for="chkDisplayFolderView">${LabelDisplayFoldersView}</label>
@ -54,6 +54,19 @@
</div>
</div>
<div class="detailSection viewStylesSection" style="display:none;">
<div class="detailSectionHeader">
${HeaderViewStyles}
</div>
<div class="detailSectionContent">
<p>${LabelSelectViewStyles}</p>
<div class="viewStylesList">
</div>
<div class="fieldDescription">${LabelSelectViewStylesHelp}</div>
</div>
</div>
<div class="detailSection">
<div class="detailSectionHeader">
${HeaderViewOrder}

View File

@ -1,7 +1,7 @@
(function ($, window, document) {
function renderViews(page, user, result) {
var folderHtml = '';
folderHtml += '<div data-role="controlgroup">';
@ -27,6 +27,39 @@
$('.folderGroupList', page).html(folderHtml).trigger('create');
}
function renderViewStyles(page, user, result) {
var folderHtml = '';
folderHtml += '<div data-role="controlgroup">';
folderHtml += result.map(function (i) {
var currentHtml = '';
var id = 'chkPlainFolder' + i.Id;
currentHtml += '<label for="' + id + '">' + i.Name + '</label>';
var isChecked = user.Configuration.PlainFolderViews.indexOf(i.Id) == -1;
var checkedHtml = isChecked ? ' checked="checked"' : '';
currentHtml += '<input class="chkPlainFolder" data-folderid="' + i.Id + '" type="checkbox" id="' + id + '"' + checkedHtml + ' />';
return currentHtml;
}).join('');
folderHtml += '</div>';
$('.viewStylesList', page).html(folderHtml).trigger('create');
if (result.length) {
$('.viewStylesSection', page).show();
} else {
$('.viewStylesSection', page).hide();
}
}
function renderLatestItems(page, user, result) {
var folderHtml = '';
@ -142,13 +175,15 @@
UserId: user.Id
}));
var promise3 = ApiClient.getUserViews(user.Id);
var promise4 = ApiClient.getJSON(ApiClient.getUrl("Users/" + user.Id + "/SpecialViewOptions"));
$.when(promise1, promise2, promise3).done(function (r1, r2, r3) {
$.when(promise1, promise2, promise3, promise4).done(function (r1, r2, r3, r4) {
renderViews(page, user, r1[0]);
renderLatestItems(page, user, r1[0]);
renderChannels(page, user, r2[0]);
renderViewOrder(page, user, r3[0]);
renderViewStyles(page, user, r4[0]);
if (hideMsg !== false) {
Dashboard.hideLoadingMsg();
@ -179,6 +214,11 @@
return i.getAttribute('data-folderid');
});
user.Configuration.PlainFolderViews = $(".chkPlainFolder:not(:checked)", page).get().map(function (i) {
return i.getAttribute('data-folderid');
});
user.Configuration.DisplayChannelsWithinViews = $(".chkGroupChannel:checked", page).get().map(function (i) {
return i.getAttribute('data-channelid');