mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added send to user mode
This commit is contained in:
parent
a59b0ce027
commit
b44c10384c
2 changed files with 40 additions and 10 deletions
|
@ -38,9 +38,20 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>${LabelSendNotificationToUsers}</label>
|
<div>
|
||||||
|
<label for="selectUsers">${LabelSendNotificationToUsers}</label>
|
||||||
|
<select id="selectUsers" data-mini="true">
|
||||||
|
<option value="All">${OptionAllUsers}</option>
|
||||||
|
<option value="Admins">${OptionAdminUsers}</option>
|
||||||
|
<option value="Custom">${OptionCustomUsers}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="selectCustomUsers" style="display: none;">
|
||||||
|
<br />
|
||||||
|
<label>${LabelSelectUsers}</label>
|
||||||
<div class="sendToUsersList">
|
<div class="sendToUsersList">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,7 +68,7 @@
|
||||||
<ul data-role="listview" class="ulForm">
|
<ul data-role="listview" class="ulForm">
|
||||||
<li>
|
<li>
|
||||||
<label for="txtTitle">${LabelMessageTitle}</label>
|
<label for="txtTitle">${LabelMessageTitle}</label>
|
||||||
<input id="txtTitle" type="text" data-mini="true" />
|
<input id="txtTitle" type="text" data-mini="true" required="required" />
|
||||||
<div class="fieldDescription tokenHelp">
|
<div class="fieldDescription tokenHelp">
|
||||||
<div>${LabelAvailableTokens}</div>
|
<div>${LabelAvailableTokens}</div>
|
||||||
<div class="tokenList" style="margin-top: .5em;"></div>
|
<div class="tokenList" style="margin-top: .5em;"></div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
function fillItems(elem, items, cssClass, idPrefix, disabledList) {
|
function fillItems(elem, items, cssClass, idPrefix, currentList, isEnabledList) {
|
||||||
|
|
||||||
var html = '<div data-role="controlgroup">';
|
var html = '<div data-role="controlgroup">';
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@
|
||||||
|
|
||||||
var id = idPrefix + u.Id;
|
var id = idPrefix + u.Id;
|
||||||
|
|
||||||
var checkedHtml = disabledList.indexOf(u.Id) != -1 ? '' : ' checked="checked"';
|
var isChecked = isEnabledList ? currentList.indexOf(u.Id) != -1 : currentList.indexOf(u.Id) == -1;
|
||||||
|
|
||||||
|
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||||
|
|
||||||
return '<label for="' + id + '">' + u.Name + '</label><input class="' + cssClass + '" type="checkbox" data-itemid="' + u.Id + '" data-mini="true" id="' + id + '"' + checkedHtml + ' />';
|
return '<label for="' + id + '">' + u.Name + '</label><input class="' + cssClass + '" type="checkbox" data-itemid="' + u.Id + '" data-mini="true" id="' + id + '"' + checkedHtml + ' />';
|
||||||
|
|
||||||
|
@ -72,19 +74,21 @@
|
||||||
|
|
||||||
notificationConfig = {
|
notificationConfig = {
|
||||||
DisabledMonitorUsers: [],
|
DisabledMonitorUsers: [],
|
||||||
DisabledSendToUsers: [],
|
SendToUsers: [],
|
||||||
DisabledServices: []
|
DisabledServices: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fillItems($('.monitorUsersList', page), users, 'chkMonitor', 'chkMonitor', notificationConfig.DisabledMonitorUsers);
|
fillItems($('.monitorUsersList', page), users, 'chkMonitor', 'chkMonitor', notificationConfig.DisabledMonitorUsers);
|
||||||
fillItems($('.sendToUsersList', page), users, 'chkSendTo', 'chkSendTo', notificationConfig.DisabledSendToUsers);
|
fillItems($('.sendToUsersList', page), users, 'chkSendTo', 'chkSendTo', notificationConfig.SendToUsers, true);
|
||||||
fillItems($('.servicesList', page), services, 'chkService', 'chkService', notificationConfig.DisabledServices);
|
fillItems($('.servicesList', page), services, 'chkService', 'chkService', notificationConfig.DisabledServices);
|
||||||
|
|
||||||
$('#chkEnabled', page).checked(notificationConfig.Enabled || false).checkboxradio('refresh');
|
$('#chkEnabled', page).checked(notificationConfig.Enabled || false).checkboxradio('refresh');
|
||||||
|
|
||||||
$('#txtTitle', page).val(notificationConfig.Title || typeInfo.DefaultTitle);
|
$('#txtTitle', page).val(notificationConfig.Title || typeInfo.DefaultTitle);
|
||||||
|
|
||||||
|
$('#selectUsers', page).val(notificationConfig.SendToUserMode).selectmenu('refresh').trigger('change');
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +127,7 @@
|
||||||
|
|
||||||
notificationConfig.Enabled = $('#chkEnabled', page).checked();
|
notificationConfig.Enabled = $('#chkEnabled', page).checked();
|
||||||
notificationConfig.Title = $('#txtTitle', page).val();
|
notificationConfig.Title = $('#txtTitle', page).val();
|
||||||
|
notificationConfig.SendToUserMode = $('#selectUsers', page).val();
|
||||||
|
|
||||||
// Don't persist if it's just the default
|
// Don't persist if it's just the default
|
||||||
if (notificationConfig.Title == typeInfo.DefaultTitle) {
|
if (notificationConfig.Title == typeInfo.DefaultTitle) {
|
||||||
|
@ -133,7 +138,7 @@
|
||||||
return c.getAttribute('data-itemid');
|
return c.getAttribute('data-itemid');
|
||||||
});
|
});
|
||||||
|
|
||||||
notificationConfig.DisabledSendToUsers = $('.chkSendTo:not(:checked)', page).get().map(function (c) {
|
notificationConfig.SendToUsers = $('.chkSendTo:checked', page).get().map(function (c) {
|
||||||
return c.getAttribute('data-itemid');
|
return c.getAttribute('data-itemid');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -141,7 +146,7 @@
|
||||||
return c.getAttribute('data-itemid');
|
return c.getAttribute('data-itemid');
|
||||||
});
|
});
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(function(r) {
|
ApiClient.updateServerConfiguration(config).done(function (r) {
|
||||||
|
|
||||||
Dashboard.navigate('notificationsettings.html');
|
Dashboard.navigate('notificationsettings.html');
|
||||||
});
|
});
|
||||||
|
@ -149,7 +154,21 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageshow', "#notificationSettingPage", function () {
|
$(document).on('pageinit', "#notificationSettingPage", function () {
|
||||||
|
|
||||||
|
var page = this;
|
||||||
|
|
||||||
|
$('#selectUsers', page).on('change', function () {
|
||||||
|
|
||||||
|
if (this.value == 'Custom') {
|
||||||
|
$('.selectCustomUsers', page).show();
|
||||||
|
} else {
|
||||||
|
$('.selectCustomUsers', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on('pageshow', "#notificationSettingPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue