Merge branch 'fewieden-calendar-multiple-icons' into develop

This commit is contained in:
Michael Teeuw 2017-03-17 15:37:40 +01:00
commit b4dfce4a44
3 changed files with 22 additions and 11 deletions

View File

@ -54,6 +54,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Updated Norwegian translation.
- Added hideLoading option for News Feed module
- Added configurable dateFormat to clock module.
- Added multiple calendar icon support.
### Fixed
- Update .gitignore to not ignore default modules folder.

View File

@ -73,8 +73,8 @@ config: {
| Option | Description
| --------------------- | -----------
| `url` | The url of the calendar .ical. This property is required. <br><br> **Possible values:** Any public accessble .ical calendar.
| `symbol` | The symbol to show in front of an event. This property is optional. <br><br> **Possible values:** See [Font Awesome](http://fontawesome.io/icons/) website.
| `color` | The font color of an event from this calendar. This property should be set if the config is set to colored: true. <br><br> **Possible values:** HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)).
| `symbol` | The symbol to show in front of an event. This property is optional. <br><br> **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. <br><br> **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. <br><br> **Example:** `'Birthday'`
| `maximumEntries` | The maximum number of events shown. Overrides global setting. **Possible values:** `0` - `100`
| `maximumNumberOfDays` | The maximum number of days in the future. Overrides global setting

View File

@ -152,10 +152,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);
}
@ -345,14 +355,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);
},
@ -390,7 +400,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];
}
}