diff --git a/.gitignore b/.gitignore index fd8f9ce..268fd4f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ composer.lock ## App ## db/ +config/app.php diff --git a/config/app.default.php b/config/app.default.php new file mode 100644 index 0000000..28423dd --- /dev/null +++ b/config/app.default.php @@ -0,0 +1,5 @@ + "", +]; \ No newline at end of file diff --git a/index.php b/index.php index 0ad5a10..55cb0a2 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,7 @@ data; $poll = Poll::create_poll($request_json); if ($poll) - Flight::json(format_poll($poll)); + Flight::json(format_poll($poll), 206); else Flight::halt(403, "

403 Forbidden

Invalid data.

"); } @@ -43,7 +44,8 @@ Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) { }); Flight::route("/", function () { - Flight::render("home", [], "body_content"); + global $VERLAINE; + Flight::render("home", ["app_url" => $VERLAINE["app_url"]], "body_content"); Flight::render("layout"); }); diff --git a/static/css/main.css b/static/css/main.css index 5f6e88b..c082fd9 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -32,8 +32,21 @@ main margin: 0 5%; } -main form input, -main form button +main p +{ + font-size: 1.5em; + text-align: center; +} +main p strong +{ + font-family: "PT Serif", serif; + font-size: 1.2em; + font-weight: normal; +} + +main input, +main button, +main a.button { transition: background 0.1s ease-in; display: block; @@ -43,34 +56,47 @@ main form button box-sizing: border-box; background: #141414; + color: #ECECEC; border: none; outline: none; font-size: 1.3em; text-align: center; + text-decoration: none; } -main form input[type="submit"], -main form button +main input[type="submit"], +main button, +main a.button { cursor: pointer; } -main form input[type="submit"] +main input[type="submit"] { margin-top: 1em; } -main form input:focus, -main form input[type="submit"]:hover, -main form button:hover +main input:focus, +main input[type="submit"]:hover, +main button:hover, +main a.button:hover { background: #1D1D1D; } -main form input[name="title"], -main form input[name="title"]:focus +main input[name="title"], +main input[name="title"]:focus { background: transparent; font-family: "PT Serif", serif; font-size: 1.5em; } +@keyframes scalex +{ + 0% + { transform: scaleX(0); } + 100% + { transform: scaleX(1); } +} + main #choices .choice { + animation: scalex 0.2s linear; display: flex; flex-direction: row; margin: auto; @@ -86,6 +112,16 @@ main #choices .choice .delete width: 4em; } +/* + * IFNEZIUN + */ +h1.poll +{ + margin: 1.5em 5%; + font-family: "PT Serif", serif; + font-size: 2.5rem; +} + footer { display: block; diff --git a/static/js/new.js b/static/js/new.js index 5b89fa8..a1d0012 100644 --- a/static/js/new.js +++ b/static/js/new.js @@ -44,7 +44,11 @@ document.addEventListener("DOMContentLoaded", () => { }).then((res) => { return res.json(); }).then((json) => { - console.log(json); + form.setAttribute("hidden", true); + let result_el = document.getElementById("result"); + result_el.innerHTML = result_el.innerHTML.replace(/:poll_title/g, json.title); + result_el.innerHTML = result_el.innerHTML.replace(/:poll_url/g, `/polls/${json.id}`); + result_el.removeAttribute("hidden"); }); }); }); \ No newline at end of file diff --git a/views/home.php b/views/home.php index 1df7e8a..f541cf5 100644 --- a/views/home.php +++ b/views/home.php @@ -11,6 +11,11 @@ +