Skip to content

Commit

Permalink
Include full address in ical event
Browse files Browse the repository at this point in the history
When possible include the full address of the event's location in
the ical event instead of just the location name
  • Loading branch information
timkaechele committed Feb 3, 2024
1 parent 31fc08b commit 4d88480
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/ical_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def icalendar(*events)
item.dtstart = event.date
item.dtend = event.end_date
item.url = event_url(event)
item.location = event.location.name if event.location
item.location = event.location.calendar_event_address if event.location
end
end
end.to_s
Expand Down
8 changes: 8 additions & 0 deletions app/models/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ def address
"#{street} #{house_number}, #{zip} #{city}"
end

def calendar_event_address
if [street, house_number, zip, city].all?(&:present?)
address
else
name
end
end

def nice_url
URI.parse(url).host
end
Expand Down

0 comments on commit 4d88480

Please sign in to comment.