2020-05-04 12:44:12 +02:00
|
|
|
define(['loading', 'libraryMenu', 'globalize', 'listViewStyle', 'emby-button'], function(loading, libraryMenu, globalize) {
|
|
|
|
'use strict';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
|
|
|
function reload(page) {
|
2019-03-06 18:18:49 +09:00
|
|
|
loading.show();
|
2020-05-04 12:44:12 +02:00
|
|
|
ApiClient.getJSON(ApiClient.getUrl('Notifications/Types')).then(function(list) {
|
|
|
|
var html = '';
|
|
|
|
var lastCategory = '';
|
2019-03-06 18:18:49 +09:00
|
|
|
var showHelp = true;
|
2019-03-09 11:37:40 +09:00
|
|
|
html += list.map(function(notification) {
|
2020-05-04 12:44:12 +02:00
|
|
|
var itemHtml = '';
|
2019-03-09 11:37:40 +09:00
|
|
|
if (notification.Category !== lastCategory) {
|
|
|
|
lastCategory = notification.Category;
|
2019-03-06 18:18:49 +09:00
|
|
|
if (lastCategory) {
|
2020-05-04 12:44:12 +02:00
|
|
|
itemHtml += '</div>';
|
|
|
|
itemHtml += '</div>';
|
2019-03-06 18:18:49 +09:00
|
|
|
}
|
|
|
|
itemHtml += '<div class="verticalSection verticalSection-extrabottompadding">';
|
|
|
|
itemHtml += '<div class="sectionTitleContainer" style="margin-bottom:1em;">';
|
|
|
|
itemHtml += '<h2 class="sectionTitle">';
|
2019-03-09 11:37:40 +09:00
|
|
|
itemHtml += notification.Category;
|
2020-05-04 12:44:12 +02:00
|
|
|
itemHtml += '</h2>';
|
2019-03-06 18:18:49 +09:00
|
|
|
if (showHelp) {
|
|
|
|
showHelp = false;
|
2019-10-04 14:34:50 -04:00
|
|
|
itemHtml += '<a is="emby-linkbutton" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/notifications.html">';
|
2020-05-04 12:44:12 +02:00
|
|
|
itemHtml += globalize.translate('Help');
|
|
|
|
itemHtml += '</a>';
|
2019-03-06 18:18:49 +09:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
itemHtml += '</div>';
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += '<div class="paperList">';
|
|
|
|
}
|
2019-03-09 11:37:40 +09:00
|
|
|
itemHtml += '<a class="listItem listItem-border" is="emby-linkbutton" data-ripple="false" href="notificationsetting.html?type=' + notification.Type + '">';
|
|
|
|
if (notification.Enabled) {
|
2020-04-26 02:37:28 +03:00
|
|
|
itemHtml += '<span class="listItemIcon material-icons notifications_active"></span>';
|
2019-03-07 22:00:13 +00:00
|
|
|
} else {
|
2020-04-26 02:37:28 +03:00
|
|
|
itemHtml += '<span class="listItemIcon material-icons notifications_off" style="background-color:#999;"></span>';
|
2019-03-07 22:00:13 +00:00
|
|
|
}
|
2019-03-06 18:18:49 +09:00
|
|
|
itemHtml += '<div class="listItemBody">';
|
2020-05-04 12:44:12 +02:00
|
|
|
itemHtml += '<div class="listItemBodyText">' + notification.Name + '</div>';
|
|
|
|
itemHtml += '</div>';
|
2020-04-26 02:37:28 +03:00
|
|
|
itemHtml += '<button type="button" is="paper-icon-button-light"><span class="material-icons mode_edit"></span></button>';
|
2020-05-04 12:44:12 +02:00
|
|
|
itemHtml += '</a>';
|
2019-03-06 18:18:49 +09:00
|
|
|
return itemHtml;
|
2020-05-04 12:44:12 +02:00
|
|
|
}).join('');
|
2019-03-06 18:18:49 +09:00
|
|
|
|
|
|
|
if (list.length) {
|
2020-05-04 12:44:12 +02:00
|
|
|
html += '</div>';
|
|
|
|
html += '</div>';
|
2019-03-06 18:18:49 +09:00
|
|
|
}
|
2020-05-04 12:44:12 +02:00
|
|
|
page.querySelector('.notificationList').innerHTML = html;
|
2019-03-06 18:18:49 +09:00
|
|
|
loading.hide();
|
2020-04-05 13:48:10 +02:00
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return function(view, params) {
|
2020-05-04 12:44:12 +02:00
|
|
|
view.addEventListener('viewshow', function() {
|
2019-03-06 18:18:49 +09:00
|
|
|
reload(view);
|
|
|
|
});
|
2020-04-05 13:48:10 +02:00
|
|
|
};
|
2019-03-07 22:00:13 +00:00
|
|
|
});
|