fix: links to upcoming episodes page
This commit is contained in:
@@ -68,7 +68,7 @@ class ApiController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/api/upcoming-episodes', name: 'api.upcoming-episodes', methods: ['GET'])]
|
#[Route('/api/monitor/upcoming-episodes', name: 'api.monitor.upcoming-episodes', methods: ['GET'])]
|
||||||
public function upcomingEpisodes(MonitorRepository $repository): Response
|
public function upcomingEpisodes(MonitorRepository $repository): Response
|
||||||
{
|
{
|
||||||
$monitors = $repository->whereAirDateNotNull();
|
$monitors = $repository->whereAirDateNotNull();
|
||||||
|
|||||||
@@ -28,4 +28,10 @@ class WebController extends AbstractController
|
|||||||
{
|
{
|
||||||
return $this->render('monitor/index.html.twig');
|
return $this->render('monitor/index.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/monitors/upcoming-episodes', name: 'app.monitor.upcoming-episodes', methods: ['GET'])]
|
||||||
|
public function upcomingEpisodes()
|
||||||
|
{
|
||||||
|
return $this->render('monitor/upcoming-episodes.html.twig');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,9 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block h2 %}Upcoming Episodes{% endblock %}
|
{% block h2 %}Test Test{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js'></script>
|
<div>
|
||||||
|
<!-- Well what are you doing here? -->
|
||||||
<div class="p-4">
|
</div>
|
||||||
<twig:Card title="Upcoming episodes of shows your monitoring">
|
|
||||||
<div id="calendar" class="text-white">
|
|
||||||
</div>
|
|
||||||
</twig:Card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.addEventListener('DOMContentLoaded', async function() {
|
|
||||||
let data = await fetch('/api/upcoming-episodes');
|
|
||||||
data = (await data.json())['data'];
|
|
||||||
|
|
||||||
const calendarEl = document.getElementById('calendar');
|
|
||||||
const calendar = new FullCalendar.Calendar(calendarEl, {
|
|
||||||
initialView: 'dayGridMonth',
|
|
||||||
events: data['episodes'],
|
|
||||||
});
|
|
||||||
calendar.render();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -4,6 +4,10 @@
|
|||||||
{% block h2 %}Monitors{% endblock %}
|
{% block h2 %}Monitors{% endblock %}
|
||||||
|
|
||||||
{% block action_buttons %}
|
{% block action_buttons %}
|
||||||
|
<a href="{{ path('app.monitor.upcoming-episodes') }}" data-turbo="false"
|
||||||
|
class="h-6 bg-orange-500/80 hover:bg-orange-600/80 px-2 text-white rounded-ms text-sm font-semibold">
|
||||||
|
Upcoming Episodes
|
||||||
|
</a>
|
||||||
<twig:ActionButton action="monitorDispatch" text="Run Monitors" />
|
<twig:ActionButton action="monitorDispatch" text="Run Monitors" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
37
templates/monitor/upcoming-episodes.html.twig
Normal file
37
templates/monitor/upcoming-episodes.html.twig
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block h2 %}Upcoming Episodes{% endblock %}
|
||||||
|
|
||||||
|
{% block action_buttons %}
|
||||||
|
<a href="{{ path('app.monitor.upcoming-episodes') }}"
|
||||||
|
class="h-6 bg-orange-500/80 hover:bg-orange-600/80 px-2 text-white rounded-ms text-sm font-semibold">
|
||||||
|
Upcoming Episodes
|
||||||
|
</a>
|
||||||
|
<twig:ActionButton action="monitorDispatch" text="Run Monitors" />
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{{ turbo_page_requires_reload() }}
|
||||||
|
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js'></script>
|
||||||
|
|
||||||
|
<div class="p-4">
|
||||||
|
<twig:Card title="Upcoming episodes of shows your monitoring">
|
||||||
|
<div id="calendar" class="text-white">
|
||||||
|
</div>
|
||||||
|
</twig:Card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', async function() {
|
||||||
|
let data = await fetch('/api/monitor/upcoming-episodes');
|
||||||
|
data = (await data.json())['data'];
|
||||||
|
|
||||||
|
const calendarEl = document.getElementById('calendar');
|
||||||
|
const calendar = new FullCalendar.Calendar(calendarEl, {
|
||||||
|
initialView: 'dayGridMonth',
|
||||||
|
events: data['episodes'],
|
||||||
|
});
|
||||||
|
calendar.render();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user