2014-04-25 13:47:56 -07:00
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
|
|
function reload(page) {
|
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-07-01 22:16:59 -07:00
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl("Notifications/Types")).done(function (list) {
|
2014-04-25 19:55:07 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
var html = '<ul data-role="listview" data-inset="true">';
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
var lastCategory = "";
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
html += list.map(function (i) {
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
var itemHtml = '';
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
if (i.Category != lastCategory) {
|
|
|
|
|
lastCategory = i.Category;
|
|
|
|
|
itemHtml += '<li data-role="list-divider">';
|
|
|
|
|
itemHtml += i.Category;
|
|
|
|
|
itemHtml += '</li>';
|
|
|
|
|
}
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
itemHtml += '<li>';
|
|
|
|
|
itemHtml += '<a href="notificationsetting.html?type=' + i.Type + '">';
|
|
|
|
|
itemHtml += '<h3>' + i.Name + '</h3>';
|
2014-04-25 19:55:07 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
if (i.Enabled) {
|
2014-05-30 12:23:56 -07:00
|
|
|
|
itemHtml += '<p style="color:#009F00;">' + Globalize.translate('LabelEnabled') + '</p>';
|
2014-04-26 20:42:05 -07:00
|
|
|
|
} else {
|
2014-05-30 12:23:56 -07:00
|
|
|
|
itemHtml += '<p style="color:#cc0000;">' + Globalize.translate('LabelDisabled') + '</p>';
|
2014-04-26 20:42:05 -07:00
|
|
|
|
}
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
itemHtml += '</a>';
|
|
|
|
|
itemHtml += '</li>';
|
|
|
|
|
|
|
|
|
|
return itemHtml;
|
|
|
|
|
|
|
|
|
|
}).join('');
|
|
|
|
|
|
|
|
|
|
html += '</ul>';
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
$('.notificationList', page).html(html).trigger('create');
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
2014-04-25 13:47:56 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('pageshow', "#notificationSettingsPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, window);
|