1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-11-24 23:04:33 +01:00

Merge branch 'tagada'

This commit is contained in:
Madeorsk 2019-02-24 14:16:41 +01:00
commit 9455338080
3 changed files with 22 additions and 0 deletions

View File

@ -6,6 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Poll Verlaine</title>
<link rel="stylesheet" type="text/css" href="<?= $VERLAINE["app_url"] ?>/static/css/main.css" />
<?php if(isset($head)): ?>
<?= $head ?>
<?php endif; ?>
</head>
<body>
<?= $body_content ?>

6
views/opengraph.php Normal file
View File

@ -0,0 +1,6 @@
<meta property="og:site_name" content="PollVerlaine" />
<meta property="og:title" content="<?= $poll->title ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?= $app_url ?>/polls/<?= $poll->id ?>" />
<meta property="og:image" content="<?= $app_url ?>/polls/<?= $poll->id ?>/results/svg" />
<meta property="og:image:type" content="image/svg+xml"/>

View File

@ -37,6 +37,7 @@ Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) {
else
{
Flight::render("poll", ["app_url" => $VERLAINE["app_url"], "poll" => $poll], "body_content");
Flight::render("opengraph", ["poll" => $poll, "app_url" => $VERLAINE["app_url"]], "head");
Flight::render("layout");
}
}
@ -105,6 +106,7 @@ Flight::route("GET /polls/@id:[a-fA-F0-9]+/results", function ($id) {
{
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]], "results_chart");
Flight::render("results", ["poll" => $poll, "chart_colors" => $VERLAINE["chart_colors"]], "body_content");
Flight::render("opengraph", ["poll" => $poll, "app_url" => $VERLAINE["app_url"]], "head");
Flight::render("layout");
}
}
@ -136,6 +138,17 @@ Flight::route("GET|DELETE /polls/@id:[a-fA-F0-9]+/@token:[a-fA-F0-9]+", function
Flight::notFound();
});
Flight::route("GET /polls/@id:[a-fA-F0-9]+/results/svg", function ($id) {
global $VERLAINE;
$poll = Poll::load_poll($id);
if ($poll)
{
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]]);
}
else
Flight::notFound();
});
Flight::route("/", function () {
global $VERLAINE;
Flight::render("home", ["app_url" => $VERLAINE["app_url"]], "body_content");