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-04-26 20:42:05 -07:00
|
|
|
|
$.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) {
|
|
|
|
|
itemHtml += '<p style="color:#009F00;">Enabled</p>';
|
|
|
|
|
} else {
|
|
|
|
|
itemHtml += '<p style="color:#cc0000;">Disabled</p>';
|
|
|
|
|
}
|
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);
|