Merge pull request #770 from amcolash/excluded_events

Calendar module excluded events filter
This commit is contained in:
Michael Teeuw 2017-03-17 14:35:30 +01:00 committed by GitHub
commit 92db5d3a35
3 changed files with 17 additions and 1 deletions

View File

@ -50,6 +50,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added console warning on startup when deprecated config options are used - Added console warning on startup when deprecated config options are used
- Add option to display temperature unit label to the current weather module - Add option to display temperature unit label to the current weather module
- Added ability to disable wrapping of news items - Added ability to disable wrapping of news items
- Added in the ability to hide events in the calendar module based on simple string filters.
- Updated Norwegian translation. - Updated Norwegian translation.
- Added hideLoading option for News Feed module - Added hideLoading option for News Feed module
- Added configurable dateFormat to clock module. - Added configurable dateFormat to clock module.

View File

@ -44,6 +44,7 @@ The following properties can be configured:
| `urgency` | When using a timeFormat of `absolute`, the `urgency` setting allows you to display events within a specific time frame as `relative`. This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates <br><br> **Possible values:** a positive integer representing the number of days for which you want a relative date, for example `7` (for 7 days) <br><br> **Default value:** `7` | `urgency` | When using a timeFormat of `absolute`, the `urgency` setting allows you to display events within a specific time frame as `relative`. This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates <br><br> **Possible values:** a positive integer representing the number of days for which you want a relative date, for example `7` (for 7 days) <br><br> **Default value:** `7`
| `broadcastEvents` | If this property is set to true, the calendar will broadcast all the events to all other modules with the notification message: `CALENDAR_EVENTS`. The event objects are stored in an array and contain the following fields: `title`, `startDate`, `endDate`, `fullDayEvent`, `location` and `geo`. <br><br> **Possible values:** `true`, `false` <br><br> **Default value:** `true` | `broadcastEvents` | If this property is set to true, the calendar will broadcast all the events to all other modules with the notification message: `CALENDAR_EVENTS`. The event objects are stored in an array and contain the following fields: `title`, `startDate`, `endDate`, `fullDayEvent`, `location` and `geo`. <br><br> **Possible values:** `true`, `false` <br><br> **Default value:** `true`
| `hidePrivate` | Hides private calendar events. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false` | `hidePrivate` | Hides private calendar events. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `excludedEvents` | An array of words / phrases from event titles that will be excluded from being shown. <br><br> **Example:** `['Birthday', 'Hide This Event']` <br> **Default value:** `[]`
### Calendar configuration ### Calendar configuration

View File

@ -38,7 +38,8 @@ Module.register("calendar", {
"De verjaardag van ": "", "De verjaardag van ": "",
"'s birthday": "" "'s birthday": ""
}, },
broadcastEvents: true broadcastEvents: true,
excludedEvents: []
}, },
// Define required scripts. // Define required scripts.
@ -128,6 +129,19 @@ Module.register("calendar", {
for (var e in events) { for (var e in events) {
var event = events[e]; var event = events[e];
var excluded = false;
for (var f in this.config.excludedEvents) {
var filter = this.config.excludedEvents[f];
if (event.title.toLowerCase().includes(filter.toLowerCase())) {
excluded = true;
break;
}
}
if (excluded) {
continue;
}
var eventWrapper = document.createElement("tr"); var eventWrapper = document.createElement("tr");
if (this.config.colored) { if (this.config.colored) {