-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expose location for calendar events #27983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,8 @@ class DialogCalendarEventEditor extends LitElement { | |
|
|
||
| @state() private _description? = ""; | ||
|
|
||
| @state() private _location? = ""; | ||
|
|
||
| @state() private _rrule?: string; | ||
|
|
||
| @state() private _allDay = false; | ||
|
|
@@ -79,6 +81,8 @@ class DialogCalendarEventEditor extends LitElement { | |
| // timezone, but floating without a timezone. | ||
| private _timeZone?: string; | ||
|
|
||
| private _hasLocation = false; | ||
|
|
||
| public showDialog(params: CalendarEventEditDialogParams): void { | ||
| this._error = undefined; | ||
| this._info = undefined; | ||
|
|
@@ -99,6 +103,10 @@ class DialogCalendarEventEditor extends LitElement { | |
| this._allDay = isDate(entry.dtstart); | ||
| this._summary = entry.summary; | ||
| this._description = entry.description; | ||
| if (entry.location) { | ||
| this._hasLocation = true; | ||
| this._location = entry.location; | ||
| } | ||
| this._rrule = entry.rrule; | ||
| if (this._allDay) { | ||
| this._dtstart = new Date(entry.dtstart + "T00:00:00"); | ||
|
|
@@ -130,6 +138,8 @@ class DialogCalendarEventEditor extends LitElement { | |
| this._dtend = undefined; | ||
| this._summary = ""; | ||
| this._description = ""; | ||
| this._location = ""; | ||
| this._hasLocation = false; | ||
| this._rrule = undefined; | ||
| fireEvent(this, "dialog-closed", { dialog: this.localName }); | ||
| } | ||
|
|
@@ -181,6 +191,15 @@ class DialogCalendarEventEditor extends LitElement { | |
| .validationMessage=${this.hass.localize("ui.common.error_required")} | ||
| dialogInitialFocus | ||
| ></ha-textfield> | ||
| <ha-textfield | ||
| class="location" | ||
| name="location" | ||
| .label=${this.hass.localize( | ||
| "ui.components.calendar.event.location" | ||
| )} | ||
| .value=${this._location} | ||
| @change=${this._handleLocationChanged} | ||
| ></ha-textfield> | ||
| <ha-textarea | ||
| class="description" | ||
| name="description" | ||
|
|
@@ -326,6 +345,10 @@ class DialogCalendarEventEditor extends LitElement { | |
| this._description = ev.target.value; | ||
| } | ||
|
|
||
| private _handleLocationChanged(ev: Event) { | ||
| this._location = (ev.target as HTMLInputElement).value; | ||
| } | ||
|
|
||
| private _handleRRuleChanged(ev) { | ||
| this._rrule = ev.detail.value; | ||
| } | ||
|
|
@@ -399,6 +422,7 @@ class DialogCalendarEventEditor extends LitElement { | |
| const data: CalendarEventMutableParams = { | ||
| summary: this._summary, | ||
| description: this._description, | ||
| location: this._location || (this._hasLocation ? "" : undefined), | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was trying to avoid here populating location key with an empty string where it wasn't previously present (I think every calendar integration supports location, but I'm not 100% sure). But once location has a value, neither undefined or null will clear it, so we have to use empty string in that case. |
||
| rrule: this._rrule || undefined, | ||
| dtstart: "", | ||
| dtend: "", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.