diff --git a/CHANGELOG.md b/CHANGELOG.md index 564564cb..3db41e98 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Korean Translation. - Added console warning on startup when deprecated config options are used - Added `DAYAFTERTOMORROW`, `UPDATE_NOTIFICATION`, `UPDATE_NOTIFICATION_MODULE`, `UPDATE_INFO` to Norwegian translations (`nn` and `nb`). +- Added multiple calendar icon support. ### Fixed - Update .gitignore to not ignore default modules folder. diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index bc2e9771..a8e3cc9e 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -68,7 +68,7 @@ config: { | Option | Description | --------------------- | ----------- | `url` | The url of the calendar .ical. This property is required.

**Possible values:** Any public accessble .ical calendar. -| `symbol` | The symbol to show in front of an event. This property is optional.

**Possible values:** See [Font Awesome](http://fontawesome.io/icons/) website. +| `symbol` | The symbol to show in front of an event. This property is optional.

**Possible values:** See [Font Awesome](http://fontawesome.io/icons/) website. To have multiple symbols you can define them in an array e.g. `["calendar", "plane"]` | `color` | The font color of an event from this calendar. This property should be set if the config is set to colored: true.

**Possible values:** HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)). | `repeatingCountTitle` | The count title for yearly repating events in this calendar.

**Example:** `'Birthday'` | `user` | The username for HTTP Basic authentication. diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 644fc1f6..529994eb 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -130,10 +130,20 @@ Module.register("calendar", { if (this.config.displaySymbol) { var symbolWrapper = document.createElement("td"); - symbolWrapper.className = "symbol"; - var symbol = document.createElement("span"); - symbol.className = "fa fa-" + this.symbolForUrl(event.url); - symbolWrapper.appendChild(symbol); + symbolWrapper.className = "symbol align-right"; + var symbols = this.symbolsForUrl(event.url); + if(typeof symbols === "string") { + symbols = [symbols]; + } + + for(var i = 0; i < symbols.length; i++) { + var symbol = document.createElement("span"); + symbol.className = "fa fa-" + symbols[i]; + if(i > 0){ + symbol.style.paddingLeft = "5px"; + } + symbolWrapper.appendChild(symbol); + } eventWrapper.appendChild(symbolWrapper); } @@ -324,14 +334,14 @@ Module.register("calendar", { }); }, - /* symbolForUrl(url) - * Retrieves the symbol for a specific url. + /* symbolsForUrl(url) + * Retrieves the symbols for a specific url. * * argument url string - Url to look for. * - * return string - The Symbol + * return string/array - The Symbols */ - symbolForUrl: function (url) { + symbolsForUrl: function (url) { return this.getCalendarProperty(url, "symbol", this.config.defaultSymbol); }, @@ -369,7 +379,7 @@ Module.register("calendar", { getCalendarProperty: function (url, property, defaultValue) { for (var c in this.config.calendars) { var calendar = this.config.calendars[c]; - if (calendar.url === url && typeof calendar[property] === "string") { + if (calendar.url === url && calendar.hasOwnProperty(property)) { return calendar[property]; } }