diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index 1fbac54e0..eed42b14d 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -156,6 +156,7 @@ h1 a:hover { .largePanelModalOpen.ui-panel-dismiss-position-right { right: 250px !important; } + .largePanelModalOpen.ui-panel-dismiss-position-left { left: 250px !important; } @@ -407,9 +408,13 @@ h1 .imageLink { } .appLinks a { - margin: 0 2px; + text-decoration: none !important; } + .appLinks a + a { + margin-left: 5px; + } + .appLinks img { height: 32px; } diff --git a/dashboard-ui/scripts/edititemsubtitles.js b/dashboard-ui/scripts/edititemsubtitles.js index 39697d3a9..b89c5a1c9 100644 --- a/dashboard-ui/scripts/edititemsubtitles.js +++ b/dashboard-ui/scripts/edititemsubtitles.js @@ -38,7 +38,7 @@ var url = 'Providers/Subtitles/Subtitles/' + id; - $.get(ApiClient.getUrl(url)).done(function (result) { + ApiClient.get(ApiClient.getUrl(url)).done(function (result) { $('.subtitleContent', page).html(result); diff --git a/dashboard-ui/scripts/userparentalcontrol.js b/dashboard-ui/scripts/userparentalcontrol.js index 521893e55..1ef5b8b51 100644 --- a/dashboard-ui/scripts/userparentalcontrol.js +++ b/dashboard-ui/scripts/userparentalcontrol.js @@ -76,11 +76,12 @@ $('.blockUnratedItems', page).html(html).trigger('create'); } - function loadUser(page, user, loggedInUser, allParentalRatings) { + function loadUser(page, user, allParentalRatings) { Dashboard.setPageTitle(user.Name); loadUnratedItems(page, user); + loadTags(page, user.Configuration.BlockedTags); populateRatings(allParentalRatings, page); @@ -111,6 +112,40 @@ Dashboard.hideLoadingMsg(); } + function loadTags(page, tags) { + + var html = ''; + + var elem = $('.blockedTags', page).html(html).trigger('create'); + + $('.btnDeleteTag', elem).on('click', function () { + + var tag = this.getAttribute('data-tag'); + + var newTags = tags.filter(function (t) { + return t != tag; + }); + + loadTags(page, newTags); + }); + } + function deleteAccessSchedule(page, schedules, index) { schedules.splice(index, 1); @@ -174,6 +209,8 @@ user.Configuration.AccessSchedules = getSchedulesFromPage(page); + user.Configuration.BlockedTags = getTagsFromPage(page); + ApiClient.updateUser(user).done(function () { onSaveComplete(page); }); @@ -203,6 +240,16 @@ saveSchedule(page); + // Disable default form submission + return false; + }, + + onTagFormSubmit: function() { + + var page = $(this).parents('.page'); + + saveTag(page); + // Disable default form submission return false; } @@ -279,6 +326,19 @@ $('#popupSchedule', page).popup('close'); } + function saveTag(page) { + + var tag = $('#txtTag', page).val(); + var tags = getTagsFromPage(page); + + if (tags.indexOf(tag) == -1) { + tags.push(tag); + loadTags(page, tags); + } + + $('#popupTag', page).popup('close'); + } + function getSchedulesFromPage(page) { return $('.liSchedule', page).map(function () { @@ -292,6 +352,21 @@ }).get(); } + function getTagsFromPage(page) { + + return $('.blockedTag', page).map(function () { + + return this.getAttribute('data-tag'); + + }).get(); + } + + function showTagPopup(page) { + + $('#popupTag', page).popup('open'); + $('#txtTag', page).val('').focus(); + } + $(document).on('pageinit', "#userParentalControlPage", function () { var page = this; @@ -302,6 +377,12 @@ showSchedulePopup(page, {}, -1); }); + + $('.btnAddTag', page).on('click', function () { + + showTagPopup(page); + }); + populateHours(page); }).on('pageshow', "#userParentalControlPage", function () { @@ -328,13 +409,11 @@ promise1 = ApiClient.getUser(userId); } - var promise2 = Dashboard.getCurrentUser(); + var promise2 = ApiClient.getParentalRatings(); - var promise3 = ApiClient.getParentalRatings(); + $.when(promise1, promise2).done(function (response1, response2) { - $.when(promise1, promise2, promise3).done(function (response1, response2, response3) { - - loadUser(page, response1[0] || response1, response2[0], response3[0]); + loadUser(page, response1[0] || response1, response2[0]); }); }); diff --git a/dashboard-ui/userparentalcontrol.html b/dashboard-ui/userparentalcontrol.html index 2dee9746f..2feba4f26 100644 --- a/dashboard-ui/userparentalcontrol.html +++ b/dashboard-ui/userparentalcontrol.html @@ -30,6 +30,17 @@
+
+
+
${LabelBlockItemsWithTags}
+ +
+
+ +
+
+
+