mirror of
https://github.com/beestat/app.git
synced 2025-05-31 04:06:32 -04:00
Fixed #295 - If there are no announcements, clicking the announcements button breaks
This commit is contained in:
parent
8087410436
commit
2155015bb6
@ -13,31 +13,36 @@ beestat.extend(beestat.component.modal.announcements, beestat.component.modal);
|
|||||||
*/
|
*/
|
||||||
beestat.component.modal.announcements.prototype.decorate_contents_ = function(parent) {
|
beestat.component.modal.announcements.prototype.decorate_contents_ = function(parent) {
|
||||||
var announcements = $.values(beestat.cache.announcement).reverse();
|
var announcements = $.values(beestat.cache.announcement).reverse();
|
||||||
announcements.forEach(function(announcement) {
|
|
||||||
parent.appendChild($.createElement('div').style({
|
|
||||||
'border-bottom': '1px solid #eee',
|
|
||||||
'margin-left': (beestat.style.size.gutter * -1) + 'px',
|
|
||||||
'margin-right': (beestat.style.size.gutter * -1) + 'px',
|
|
||||||
'margin-top': (beestat.style.size.gutter) + 'px',
|
|
||||||
'margin-bottom': (beestat.style.size.gutter) + 'px'
|
|
||||||
}));
|
|
||||||
|
|
||||||
var icon = new beestat.component.icon(announcement.icon)
|
if (announcements.length === 0) {
|
||||||
.set_text(announcement.title +
|
parent.appendChild($.createElement('p').innerText('No recent announcements! :)'));
|
||||||
' • ' +
|
} else {
|
||||||
moment.utc(announcement.created_at).fromNow());
|
announcements.forEach(function(announcement) {
|
||||||
|
parent.appendChild($.createElement('div').style({
|
||||||
|
'border-bottom': '1px solid #eee',
|
||||||
|
'margin-left': (beestat.style.size.gutter * -1) + 'px',
|
||||||
|
'margin-right': (beestat.style.size.gutter * -1) + 'px',
|
||||||
|
'margin-top': (beestat.style.size.gutter) + 'px',
|
||||||
|
'margin-bottom': (beestat.style.size.gutter) + 'px'
|
||||||
|
}));
|
||||||
|
|
||||||
icon.render(parent);
|
var icon = new beestat.component.icon(announcement.icon)
|
||||||
|
.set_text(announcement.title +
|
||||||
|
' • ' +
|
||||||
|
moment.utc(announcement.created_at).fromNow());
|
||||||
|
|
||||||
beestat.dispatcher.dispatchEvent('view_announcements');
|
icon.render(parent);
|
||||||
|
|
||||||
parent.appendChild($.createElement('p').innerHTML(announcement.text));
|
beestat.dispatcher.dispatchEvent('view_announcements');
|
||||||
});
|
|
||||||
|
|
||||||
beestat.setting(
|
parent.appendChild($.createElement('p').innerHTML(announcement.text));
|
||||||
'last_read_announcement_id',
|
});
|
||||||
announcements[0].announcement_id
|
|
||||||
);
|
beestat.setting(
|
||||||
|
'last_read_announcement_id',
|
||||||
|
announcements[0].announcement_id
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user