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
|
|
|
|
|
2015-09-22 10:09:29 -07:00
|
|
|
|
var html = '';
|
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;
|
2015-09-22 10:09:29 -07:00
|
|
|
|
|
|
|
|
|
if (lastCategory) {
|
|
|
|
|
itemHtml += '</div>';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
itemHtml += '<h1>';
|
2014-04-26 20:42:05 -07:00
|
|
|
|
itemHtml += i.Category;
|
2015-09-22 10:09:29 -07:00
|
|
|
|
itemHtml += '</h1>';
|
|
|
|
|
|
|
|
|
|
itemHtml += '<div class="paperList" style="margin-bottom:2em;">';
|
2014-04-26 20:42:05 -07:00
|
|
|
|
}
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2015-09-22 10:09:29 -07:00
|
|
|
|
itemHtml += '<a class="clearLink" href="notificationsetting.html?type=' + i.Type + '">';
|
|
|
|
|
itemHtml += '<paper-icon-item>';
|
2014-04-25 19:55:07 -07:00
|
|
|
|
|
2014-04-26 20:42:05 -07:00
|
|
|
|
if (i.Enabled) {
|
2015-09-22 10:09:29 -07:00
|
|
|
|
itemHtml += '<paper-fab class="listAvatar blue" icon="notifications-active" item-icon></paper-fab>';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
itemHtml += '<paper-fab class="listAvatar" style="background-color:#999;" icon="notifications-off" item-icon></paper-fab>';
|
2014-04-26 20:42:05 -07:00
|
|
|
|
}
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
2015-09-22 10:09:29 -07:00
|
|
|
|
itemHtml += '<paper-item-body two-line>';
|
|
|
|
|
itemHtml += '<div>' + i.Name + '</div>';
|
|
|
|
|
|
|
|
|
|
itemHtml += '</paper-item-body>';
|
|
|
|
|
|
|
|
|
|
itemHtml += '<paper-icon-button icon="mode-edit"></paper-icon-button>';
|
|
|
|
|
|
|
|
|
|
itemHtml += '</paper-icon-item>';
|
2014-04-26 20:42:05 -07:00
|
|
|
|
itemHtml += '</a>';
|
|
|
|
|
|
|
|
|
|
return itemHtml;
|
|
|
|
|
|
|
|
|
|
}).join('');
|
|
|
|
|
|
2015-09-22 10:09:29 -07:00
|
|
|
|
html += '</div>';
|
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
|
|
|
|
}
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
$(document).on('pageshow', "#notificationSettingsPage", function () {
|
2014-04-25 13:47:56 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, window);
|