diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html index e41b55c080..0d668fb1c6 100644 --- a/dashboard-ui/itemdetails.html +++ b/dashboard-ui/itemdetails.html @@ -253,7 +253,7 @@ diff --git a/dashboard-ui/scripts/homelatest.js b/dashboard-ui/scripts/homelatest.js index 806287fec6..35576025c8 100644 --- a/dashboard-ui/scripts/homelatest.js +++ b/dashboard-ui/scripts/homelatest.js @@ -1,6 +1,8 @@ (function ($, document) { - function loadSections(page, userId) { + function loadSections(page, user) { + + var userId = user.Id; var i, length; var sectionCount = 3; @@ -21,7 +23,7 @@ var latestMediElem = $('.section0', page); - Sections.loadRecentlyAdded(latestMediElem, userId, context).done(function () { + Sections.loadRecentlyAdded(latestMediElem, user, context).done(function () { $('h1', latestMediElem).addClass('firstListHeader'); }); @@ -33,9 +35,9 @@ var page = this; - var userId = Dashboard.getCurrentUserId(); - - loadSections(page, userId); + Dashboard.getCurrentUser().done(function (user) { + loadSections(page, user); + }); }); diff --git a/dashboard-ui/scripts/indexpage.js b/dashboard-ui/scripts/indexpage.js index fe660f283b..4b37f43ac5 100644 --- a/dashboard-ui/scripts/indexpage.js +++ b/dashboard-ui/scripts/indexpage.js @@ -119,7 +119,7 @@ }); } - function loadRecentlyAdded(elem, userId, context) { + function loadRecentlyAdded(elem, user, context) { var options = { @@ -130,14 +130,18 @@ EnableImageTypes: "Primary,Backdrop,Banner,Thumb" }; - return ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) { + return ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).done(function (items) { var html = ''; if (items.length) { html += '
'; html += '

' + Globalize.translate('HeaderLatestMedia') + '

'; - html += '' + Globalize.translate('ButtonEdit') + ''; + + if (user.Policy.EnableUserPreferenceAccess) { + html += '' + Globalize.translate('ButtonEdit') + ''; + } + html += '
'; html += '
'; html += LibraryBrowser.getPosterViewHtml({ @@ -192,7 +196,7 @@ }); } - function loadLibraryTiles(elem, userId, shape, index, autoHideOnMobile, showTitles) { + function loadLibraryTiles(elem, user, shape, index, autoHideOnMobile, showTitles) { if (autoHideOnMobile) { $(elem).addClass('hiddenSectionOnMobile'); @@ -200,7 +204,7 @@ $(elem).removeClass('hiddenSectionOnMobile'); } - getUserViews(userId).done(function (items) { + getUserViews(user.Id).done(function (items) { var html = ''; @@ -210,7 +214,11 @@ html += '
'; html += '

' + Globalize.translate('HeaderMyViews') + '

'; - html += '' + Globalize.translate('ButtonEdit') + ''; + + if (user.Policy.EnableUserPreferenceAccess) { + html += '' + Globalize.translate('ButtonEdit') + ''; + } + html += '
'; html += '
'; @@ -475,7 +483,9 @@ } - function loadSection(page, userId, displayPreferences, index) { + function loadSection(page, user, displayPreferences, index) { + + var userId = user.Id; var section = displayPreferences.CustomPrefs['home' + index] || getDefaultSection(index); @@ -484,19 +494,19 @@ var elem = $('.section' + index, page); if (section == 'latestmedia') { - Sections.loadRecentlyAdded(elem, userId); + Sections.loadRecentlyAdded(elem, user); } else if (section == 'librarytiles') { - Sections.loadLibraryTiles(elem, userId, 'backdrop', index, false, showLibraryTileNames); + Sections.loadLibraryTiles(elem, user, 'backdrop', index, false, showLibraryTileNames); } else if (section == 'smalllibrarytiles') { - Sections.loadLibraryTiles(elem, userId, 'homePageSmallBackdrop', index, false, showLibraryTileNames); + Sections.loadLibraryTiles(elem, user, 'homePageSmallBackdrop', index, false, showLibraryTileNames); } else if (section == 'smalllibrarytiles-automobile') { - Sections.loadLibraryTiles(elem, userId, 'homePageSmallBackdrop', index, true, showLibraryTileNames); + Sections.loadLibraryTiles(elem, user, 'homePageSmallBackdrop', index, true, showLibraryTileNames); } else if (section == 'librarytiles-automobile') { - Sections.loadLibraryTiles(elem, userId, 'backdrop', index, true, showLibraryTileNames); + Sections.loadLibraryTiles(elem, user, 'backdrop', index, true, showLibraryTileNames); } else if (section == 'librarybuttons') { Sections.loadlibraryButtons(elem, userId, index); @@ -521,7 +531,7 @@ } } - function loadSections(page, userId, displayPreferences) { + function loadSections(page, user, displayPreferences) { var i, length; var sectionCount = 4; @@ -540,7 +550,7 @@ for (i = 0, length = sectionCount; i < length; i++) { - loadSection(page, userId, displayPreferences, i); + loadSection(page, user, displayPreferences, i); } } @@ -623,7 +633,11 @@ ApiClient.getDisplayPreferences('home', userId, 'webclient').done(function (result) { showWelcomeIfNeeded(page, result); - loadSections(page, userId, result); + + Dashboard.getCurrentUser().done(function (user) { + + loadSections(page, user, result); + }); }); }); diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 4d38cce679..53ff5a5cc2 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -101,6 +101,12 @@ } else { $('.btnMoreCommands', page).show(); } + + if (user.Policy.IsAdministrator) { + $('.chapterSettingsButton', page).show(); + } else { + $('.chapterSettingsButton', page).hide(); + } }); if (item.LocationType == "Offline") {