define(['jQuery', 'listViewStyle'], function ($) { function reload(page) { Dashboard.showLoadingMsg(); ApiClient.getJSON(ApiClient.getUrl("Notifications/Types")).then(function (list) { var html = ''; var lastCategory = ""; html += list.map(function (i) { var itemHtml = ''; if (i.Category != lastCategory) { lastCategory = i.Category; if (lastCategory) { itemHtml += ''; } itemHtml += '

'; itemHtml += i.Category; itemHtml += '

'; itemHtml += '
'; } itemHtml += ''; itemHtml += '
'; if (i.Enabled) { itemHtml += 'notifications_active'; } else { itemHtml += 'notifications_off'; } itemHtml += '
'; itemHtml += '
' + i.Name + '
'; itemHtml += '
'; itemHtml += ''; itemHtml += '
'; itemHtml += '
'; return itemHtml; }).join(''); if (list.length) { html += '
'; } $('.notificationList', page).html(html).trigger('create'); Dashboard.hideLoadingMsg(); }); } function getTabs() { return [ { href: 'notificationsettings.html', name: Globalize.translate('TabNotifications') }, { href: 'appservices.html?context=notifications', name: Globalize.translate('TabServices') }]; } return function (view, params) { view.addEventListener('viewshow', function () { LibraryMenu.setTabs('notifications', 0, getTabs); reload(view); }); }; });