From ddc966d515c9305bda6ce54955e256e0cb21280a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 15 Apr 2015 17:59:20 -0400 Subject: [PATCH] added user view setting --- dashboard-ui/mypreferencesdisplay.html | 17 +++++++- dashboard-ui/scripts/mypreferencesdisplay.js | 44 +++++++++++++++++++- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/dashboard-ui/mypreferencesdisplay.html b/dashboard-ui/mypreferencesdisplay.html index 95327ee868..c91c9c6ca0 100644 --- a/dashboard-ui/mypreferencesdisplay.html +++ b/dashboard-ui/mypreferencesdisplay.html @@ -27,7 +27,7 @@
${LabelSelectFolderGroupsHelp}

- +
@@ -35,7 +35,7 @@
${LabelDisplayCollectionsViewHelp}
- +
@@ -54,6 +54,19 @@
+ +
${HeaderViewOrder} diff --git a/dashboard-ui/scripts/mypreferencesdisplay.js b/dashboard-ui/scripts/mypreferencesdisplay.js index 1f33a5bce4..74a8fb8099 100644 --- a/dashboard-ui/scripts/mypreferencesdisplay.js +++ b/dashboard-ui/scripts/mypreferencesdisplay.js @@ -1,7 +1,7 @@ (function ($, window, document) { function renderViews(page, user, result) { - + var folderHtml = ''; folderHtml += '
'; @@ -27,6 +27,39 @@ $('.folderGroupList', page).html(folderHtml).trigger('create'); } + function renderViewStyles(page, user, result) { + + var folderHtml = ''; + + folderHtml += '
'; + folderHtml += result.map(function (i) { + + var currentHtml = ''; + + var id = 'chkPlainFolder' + i.Id; + + currentHtml += ''; + + var isChecked = user.Configuration.PlainFolderViews.indexOf(i.Id) == -1; + var checkedHtml = isChecked ? ' checked="checked"' : ''; + + currentHtml += ''; + + return currentHtml; + + }).join(''); + + folderHtml += '
'; + + $('.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');