Added config option to calendar-icons for recurring- and fullday-events

This commit is contained in:
rejas 2020-07-08 21:53:34 +02:00
parent 29ed63286c
commit 3b5a0e8d66
3 changed files with 17 additions and 7 deletions

View File

@ -14,6 +14,7 @@ _This release is scheduled to be released on 2020-10-01._
- Test coverage with Istanbul, run it with `npm run test:coverage`. - Test coverage with Istanbul, run it with `npm run test:coverage`.
- Add lithuanian language. - Add lithuanian language.
- Added support in weatherforecast for OpenWeather onecall API. - Added support in weatherforecast for OpenWeather onecall API.
- Added config option to calendar-icons for recurring- and fullday-events
### Updated ### Updated

View File

@ -13,6 +13,8 @@ Module.register("calendar", {
maximumNumberOfDays: 365, maximumNumberOfDays: 365,
displaySymbol: true, displaySymbol: true,
defaultSymbol: "calendar", // Fontawesome Symbol see https://fontawesome.com/cheatsheet?from=io defaultSymbol: "calendar", // Fontawesome Symbol see https://fontawesome.com/cheatsheet?from=io
fullDaySymbol: "calendar", // Fontawesome Symbol
recurringSymbol: "calendar", // Fontawesome Symbol
showLocation: false, showLocation: false,
displayRepeatingCountTitle: false, displayRepeatingCountTitle: false,
defaultRepeatingCountTitle: "", defaultRepeatingCountTitle: "",
@ -217,7 +219,7 @@ Module.register("calendar", {
var symbolClass = this.symbolClassForUrl(event.url); var symbolClass = this.symbolClassForUrl(event.url);
symbolWrapper.className = "symbol align-right " + symbolClass; symbolWrapper.className = "symbol align-right " + symbolClass;
var symbols = this.symbolsForUrl(event.url); var symbols = this.symbolsForEvent(event);
if (typeof symbols === "string") { if (typeof symbols === "string") {
symbols = [symbols]; symbols = [symbols];
} }
@ -559,15 +561,21 @@ Module.register("calendar", {
}, },
/** /**
* symbolsForUrl(url) * symbolsForEvent(event)
* Retrieves the symbols for a specific url. * Retrieves the symbols for a specific event.
* *
* argument url string - Url to look for. * argument event object - Event to look for.
* *
* return string/array - The Symbols * return string/array - The Symbols
*/ */
symbolsForUrl: function (url) { symbolsForEvent: function (event) {
return this.getCalendarProperty(url, "symbol", this.config.defaultSymbol); if (event.recurringEvent === true) {
return this.getCalendarProperty(event.url, "recurringSymbol", this.config.recurringSymbol);
}
if (event.fullDayEvent === true) {
return this.getCalendarProperty(event.url, "fullDaySymbol", this.config.recurringSymbol);
}
return this.getCalendarProperty(event.url, "symbol", this.config.defaultSymbol);
}, },
/** /**
@ -756,7 +764,7 @@ Module.register("calendar", {
var calendar = this.calendarData[url]; var calendar = this.calendarData[url];
for (var e in calendar) { for (var e in calendar) {
var event = cloneObject(calendar[e]); var event = cloneObject(calendar[e]);
event.symbol = this.symbolsForUrl(url); event.symbol = this.symbolsForEvent(event);
event.calendarName = this.calendarNameForUrl(url); event.calendarName = this.calendarNameForUrl(url);
event.color = this.colorForUrl(url); event.color = this.colorForUrl(url);
delete event.url; delete event.url;

View File

@ -254,6 +254,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu
startDate: startDate.format("x"), startDate: startDate.format("x"),
endDate: endDate.format("x"), endDate: endDate.format("x"),
fullDayEvent: isFullDayEvent(event), fullDayEvent: isFullDayEvent(event),
recurringEvent: true,
class: event.class, class: event.class,
firstYear: event.start.getFullYear(), firstYear: event.start.getFullYear(),
location: location, location: location,