Skip to content

Commit

Permalink
Added support for event location in template display
Browse files Browse the repository at this point in the history
  • Loading branch information
jclarke0000 committed Mar 28, 2018
1 parent ccf3c5b commit 20d3188
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions MMM-MyCalendar.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
}

.MMM-MyCalendar .calendar-event .title,
.MMM-MyCalendar .calendar-event .time {
.MMM-MyCalendar .calendar-event .time,
.MMM-MyCalendar .calendar-event .location {
display: block;
padding-left: 32px;
white-space: nowrap;
Expand All @@ -61,7 +62,8 @@
color: #FFFFFF;
padding-top: 2px;
}
.MMM-MyCalendar .calendar-event .time {
.MMM-MyCalendar .calendar-event .time,
.MMM-MyCalendar .calendar-event .location {
font-size: 16px;
}

Expand Down
7 changes: 6 additions & 1 deletion MMM-MyCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Module.register("MMM-MyCalendar", {
"'s birthday": ""
},
broadcastEvents: true,
excludedEvents: []
excludedEvents: [],
showLocation: true
},

// Define required scripts.
Expand Down Expand Up @@ -201,6 +202,9 @@ Module.register("MMM-MyCalendar", {
}

fEvent.title = this.titleTransform(event.title) + repeatingCountTitle;
if (event.location && this.config.showLocation) {
fEvent.location = event.location;
}

//console.log(event.today);
var now = new Date();
Expand Down Expand Up @@ -351,6 +355,7 @@ Module.register("MMM-MyCalendar", {
return a.startDate - b.startDate;
});


return events.slice(0, this.config.maximumEntries);
},

Expand Down
1 change: 1 addition & 0 deletions MMM-MyCalendar.njk
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</span>
<span class="title">{{ event.title }}</span>
<span class="time">{{ event.eventTime }}</span>
<span class="location">{{ event.location }}</span>
</div>
{% else %}
<span class="small dimmed no-events">{{ phrases.empty | safe }}</span>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The following properties can be configured:
| `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:** `[]`
| `columns` | Whether to display the calendar events in two vertical columns instead of one. Useful if you've allocated a wide area for the calendar. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `eventHeight` | The height in pixels of a single calendar entry. You shouldn't need to set this unless you make css changes that alter the height of an entry. It's needed only when `columns` is set to `true`. <br><br> **Default value:** `59`
| `showLocation` | Whether to show the event's location. <br><br> **Possible values:** `true` or `false`.<br><br> **Default value:** `true`

### Calendar configuration

Expand Down

0 comments on commit 20d3188

Please sign in to comment.