mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
closes #21 feat: add calendar stream URL to meetups
This commit adds a calendar stream URL to each meetup. The URL is copied to the clipboard when the user clicks on a new button added to the UI. The copied URL can be pasted into a compatible calendar app, allowing the user to easily add the meetup to their calendar. This feature was added to several views including 'profile/meetups', 'meetup/landing-page', and 'meetup/landing-page-event'. The associated controller 'DownloadMeetupCalendar' and livewire components were also updated accordingly.
This commit is contained in:
@@ -19,7 +19,7 @@ class DownloadMeetupCalendar extends Controller
|
||||
if ($request->has('meetup')) {
|
||||
$meetup = Meetup::query()
|
||||
->with([
|
||||
'meetupEvents',
|
||||
'meetupEvents.meetup',
|
||||
])
|
||||
->findOrFail($request->input('meetup'));
|
||||
$events = $meetup->meetupEvents;
|
||||
|
||||
@@ -20,37 +20,41 @@ class LandingPage extends Component
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->meetup->load([
|
||||
'media',
|
||||
]);
|
||||
$this->meetup
|
||||
->loadCount([
|
||||
'meetupEvents'
|
||||
])
|
||||
->load([
|
||||
'media',
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.meetup.landing-page', [
|
||||
'meetupEvents' => MeetupEvent::query()
|
||||
->with([
|
||||
'meetup.city.country',
|
||||
])
|
||||
->where('meetup_events.meetup_id', $this->meetup->id)
|
||||
->where('meetup_events.start', '>=', now()->subDay())
|
||||
->orderBy('start')
|
||||
->get(),
|
||||
->with([
|
||||
'meetup.city.country',
|
||||
])
|
||||
->where('meetup_events.meetup_id', $this->meetup->id)
|
||||
->where('meetup_events.start', '>=', now()->subDay())
|
||||
->orderBy('start')
|
||||
->get(),
|
||||
'events' => MeetupEvent::query()
|
||||
->with([
|
||||
'meetup.city.country',
|
||||
])
|
||||
->where('meetup_events.meetup_id', $this->meetup->id)
|
||||
->where('meetup_events.start', '>=', now()->subDay())
|
||||
->orderBy('start')
|
||||
->get()
|
||||
->map(fn ($event) => [
|
||||
'id' => $event->id,
|
||||
'startDate' => $event->start,
|
||||
'endDate' => $event->start->addHours(1),
|
||||
'location' => $event->location,
|
||||
'description' => $event->description,
|
||||
]),
|
||||
->with([
|
||||
'meetup.city.country',
|
||||
])
|
||||
->where('meetup_events.meetup_id', $this->meetup->id)
|
||||
->where('meetup_events.start', '>=', now()->subDay())
|
||||
->orderBy('start')
|
||||
->get()
|
||||
->map(fn($event) => [
|
||||
'id' => $event->id,
|
||||
'startDate' => $event->start,
|
||||
'endDate' => $event->start->addHours(1),
|
||||
'location' => $event->location,
|
||||
'description' => $event->description,
|
||||
]),
|
||||
])
|
||||
->layout('layouts.guest', [
|
||||
'SEOData' => new SEOData(
|
||||
|
||||
@@ -38,13 +38,13 @@ class Meetups extends Component
|
||||
}
|
||||
|
||||
$this->meetups = Meetup::query()
|
||||
->with([
|
||||
'city',
|
||||
])
|
||||
->where('name', 'ilike', '%'.$this->search.'%')
|
||||
->orderBy('name')
|
||||
->limit(10)
|
||||
->get();
|
||||
->with([
|
||||
'city',
|
||||
])
|
||||
->where('name', 'ilike', '%' . $this->search . '%')
|
||||
->orderBy('name')
|
||||
->limit(10)
|
||||
->get();
|
||||
$this->myMeetups = auth()
|
||||
->user()
|
||||
->meetups()
|
||||
@@ -64,7 +64,11 @@ class Meetups extends Component
|
||||
'link' => route('meetup.landing', [
|
||||
'country' => $meetup->city->country->code,
|
||||
'meetup' => $meetup,
|
||||
])
|
||||
]),
|
||||
'ics' => route('meetup.ics', [
|
||||
'country' => $meetup->city->country->code,
|
||||
'meetup' => $meetup,
|
||||
]),
|
||||
])
|
||||
->toArray();
|
||||
if (count($this->myMeetups) > 0) {
|
||||
@@ -83,20 +87,20 @@ class Meetups extends Component
|
||||
public function updatedSearch($value)
|
||||
{
|
||||
$this->meetups = Meetup::query()
|
||||
->with([
|
||||
'city',
|
||||
])
|
||||
->where('name', 'ilike', '%'.$value.'%')
|
||||
->orderBy('name')
|
||||
->limit(10)
|
||||
->get();
|
||||
->with([
|
||||
'city',
|
||||
])
|
||||
->where('name', 'ilike', '%' . $value . '%')
|
||||
->orderBy('name')
|
||||
->limit(10)
|
||||
->get();
|
||||
}
|
||||
|
||||
public function signUpForMeetup($id)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$user->meetups()
|
||||
->toggle($id);
|
||||
->toggle($id);
|
||||
$this->myMeetups = auth()
|
||||
->user()
|
||||
->meetups()
|
||||
@@ -121,11 +125,15 @@ class Meetups extends Component
|
||||
'link' => route('meetup.landing', [
|
||||
'country' => $meetup->city->country->code,
|
||||
'meetup' => $meetup,
|
||||
])
|
||||
]),
|
||||
'ics' => route('meetup.ics', [
|
||||
'country' => $meetup->city->country->code,
|
||||
'meetup' => $meetup,
|
||||
]),
|
||||
])
|
||||
->toArray();
|
||||
$this->notification()
|
||||
->success(__('Saved.'));
|
||||
->success(__('Saved.'));
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
Reference in New Issue
Block a user