mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Finish loading empty calendars. Fixes issue: #124
This commit is contained in:
parent
700ebc53f8
commit
c4bfa6d4d8
@ -112,6 +112,18 @@ The following properties can be configured:
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>loadingText</code></td>
|
||||
<td>Text to display while loading item.<br>
|
||||
<br><b>Default value:</b> <code>'Loading events …'</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>emptyCalendarText</code></td>
|
||||
<td>Text to display when there are no upcoming events.<br>
|
||||
<br><b>Default value:</b> <code>''No upcoming events.'</code>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -28,7 +28,9 @@ Module.register('calendar',{
|
||||
],
|
||||
titleReplace: {
|
||||
'De verjaardag van ' : ''
|
||||
}
|
||||
},
|
||||
loadingText: 'Loading events …',
|
||||
emptyCalendarText: 'No upcoming events.'
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
@ -55,6 +57,7 @@ Module.register('calendar',{
|
||||
}
|
||||
|
||||
this.calendarData = {};
|
||||
this.loaded = false;
|
||||
},
|
||||
|
||||
// Override socket notification handler.
|
||||
@ -62,6 +65,7 @@ Module.register('calendar',{
|
||||
if (notification === 'CALENDAR_EVENTS') {
|
||||
if (this.hasCalendarURL(payload.url)) {
|
||||
this.calendarData[payload.url] = payload.events;
|
||||
this.loaded = true;
|
||||
}
|
||||
} else if(notification === 'FETCH_ERROR') {
|
||||
Log.error('Calendar Error. Could not fetch calendar: ' + payload.url);
|
||||
@ -82,7 +86,7 @@ Module.register('calendar',{
|
||||
wrapper.className = "small";
|
||||
|
||||
if (events.length === 0) {
|
||||
wrapper.innerHTML = "Loading events ...";
|
||||
wrapper.innerHTML = (this.loaded) ? this.config.emptyCalendarText : this.config.loadingText;
|
||||
wrapper.className = "small dimmed";
|
||||
return wrapper;
|
||||
}
|
||||
|
@ -123,10 +123,6 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
* Broadcast the exsisting events.
|
||||
*/
|
||||
this.broadcastEvents = function() {
|
||||
if (events.length <= 0) {
|
||||
//console.log('No events to broadcast yet.');
|
||||
return;
|
||||
}
|
||||
//console.log('Broadcasting ' + events.length + ' events.');
|
||||
eventsReceivedCallback(self);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user