added an allow mode filter for tags

This commit is contained in:
Luke Pulverenti 2015-02-09 01:17:11 -05:00
parent dea551e078
commit ee34b9ee18
5 changed files with 49 additions and 18 deletions

View File

@ -4,8 +4,8 @@
<title>${TitleSignIn}</title>
</head>
<body class="serverlessPage">
<div class="backdropContainer" style="background-image:url(css/images/splash.png);top:0;"></div>
<div id="connectLoginPage" data-role="page" class="page standalonePage connectLoginPage lightBackdropPage backdropPage staticBackdropPage" data-theme="b" style="background-color: rgba(20, 20,20, .75)!important;">
<div class="backdropContainer" style="background-image:url(css/images/splash.jpg);top:0;"></div>
<div id="connectLoginPage" data-role="page" class="page standalonePage connectLoginPage lightBackdropPage backdropPage staticBackdropPage" data-theme="b" style="background-color: rgba(0, 0,0, .9)!important;">
<div data-role="content">

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 KiB

View File

@ -81,7 +81,7 @@
Dashboard.setPageTitle(user.Name);
loadUnratedItems(page, user);
loadTags(page, user.Policy.BlockedTags);
loadTags(page, user.Policy.TagFilters);
populateRatings(allParentalRatings, page);
@ -120,11 +120,17 @@
li += '<a href="#">';
li += '<div style="font-weight:normal;">' + h + '</div>';
li += '<h3>' + h.Tag + '</h3>';
if (h.Mode == 'Allow') {
li += '<p style="color:green;">Allow</p>';
} else if (h.Mode == 'Block') {
li += '<p style="color:red;">Block</p>';
}
li += '</a>';
li += '<a class="blockedTag btnDeleteTag" href="#" data-tag="' + h + '"></a>';
li += '<a class="tagFilter btnDeleteTag" href="#" data-tag="' + h.Tag + '" data-mode="' + h.Mode + '"></a>';
li += '</li>';
@ -132,14 +138,15 @@
}).join('') + '</ul>';
var elem = $('.blockedTags', page).html(html).trigger('create');
var elem = $('.tagFilters', page).html(html).trigger('create');
$('.btnDeleteTag', elem).on('click', function () {
var tag = this.getAttribute('data-tag');
var mode = this.getAttribute('data-mode');
var newTags = tags.filter(function (t) {
return t != tag;
return t.Tag != tag || t.Mode != mode;
});
loadTags(page, newTags);
@ -209,7 +216,7 @@
user.Policy.AccessSchedules = getSchedulesFromPage(page);
user.Policy.BlockedTags = getTagsFromPage(page);
user.Policy.TagFilters = getTagsFromPage(page);
ApiClient.updateUserPolicy(user.Id, user.Policy).done(function () {
onSaveComplete(page);
@ -244,8 +251,8 @@
return false;
},
onTagFormSubmit: function() {
onTagFormSubmit: function () {
var page = $(this).parents('.page');
saveTag(page);
@ -329,12 +336,15 @@
function saveTag(page) {
var tag = $('#txtTag', page).val();
var mode = $('#selectTagMode', page).val();
var tags = getTagsFromPage(page);
if (tags.indexOf(tag) == -1) {
tags.push(tag);
loadTags(page, tags);
}
tags.push({
Tag: tag,
Mode: mode
});
loadTags(page, tags);
$('#popupTag', page).popup('close');
}
@ -354,9 +364,12 @@
function getTagsFromPage(page) {
return $('.blockedTag', page).map(function () {
return $('.tagFilter', page).map(function () {
return this.getAttribute('data-tag');
return {
Tag: this.getAttribute('data-tag'),
Mode: this.getAttribute('data-mode')
};
}).get();
}
@ -365,6 +378,7 @@
$('#popupTag', page).popup('open');
$('#txtTag', page).val('').focus();
$('#selectTagMode', page).val('Block').selectmenu('refresh').trigger('change');
}
$(document).on('pageinit', "#userParentalControlPage", function () {
@ -383,6 +397,15 @@
showTagPopup(page);
});
$('#selectTagMode', page).on('change', function () {
if (this.value == 'Allow') {
$('.allowModeHelp', page).show();
} else {
$('.allowModeHelp', page).hide();
}
});
populateHours(page);
}).on('pageshow', "#userParentalControlPage", function () {

View File

@ -32,10 +32,10 @@
<div>
<div>
<div class="ui-controlgroup-label" style="display:inline-block;">${LabelBlockItemsWithTags}</div>
<div class="ui-controlgroup-label" style="display:inline-block;">${LabelBlockOrAllowItemsWithTags}</div>
<button type="button" class="btnAddTag" data-inline="true" data-mini="true" data-iconpos="notext" data-icon="plus" style="vertical-align:middle;margin: -5px 0 0 1em;">${ButtonAdd}</button>
</div>
<div class="blockedTags" style="margin-top:.5em;">
<div class="tagFilters" style="margin-top:.5em;">
</div>
</div>
@ -81,6 +81,14 @@
<label for="txtTag">${LabelTag}</label>
<input id="txtTag" type="text" required="required" />
</li>
<li>
<label for="selectTagMode">${LabelTagFilterMode}</label>
<select id="selectTagMode" data-mini="true">
<option value="Block">${OptionBlockItemWithTag}</option>
<option value="Allow">${OptionAllowItemWithTag}</option>
</select>
<div class="fieldDescription allowModeHelp">${LabelTagFilterAllowModeHelp}</div>
</li>
<li>
<button type="submit" data-icon="plus" data-theme="b" data-mini="true">${ButtonAdd}</button>
<button type="button" data-icon="delete" data-mini="true" onclick="$(this).parents('.popup').popup('close');">${ButtonCancel}</button>