Tentatively finish poll creation view

This commit is contained in:
Les De Ridder 2018-10-12 18:54:48 +02:00
parent d49ba18d61
commit 41bc4f6875
3 changed files with 134 additions and 10 deletions

View File

@ -16,8 +16,8 @@ class CreatePollsTable extends Migration
Schema::create('polls', function (Blueprint $table) {
$table->char('id', 6);
$table->string('question');
$table->enum('type', ['cookies', 'codes']);
$table->boolean('multiple_answers_allowed');
$table->enum('duplicate_vote_checking', ['none', 'cookies', 'codes']);
$table->boolean('allow_multiple_answers');
$table->timestamp('created_at');
$table->timestamp('closes_at')->nullable();
$table->string('admin_password')->nullable();

View File

@ -6,12 +6,14 @@
<form action="{{ action('PollController@create') }}" method="post">
@csrf
<section class="grid grid-large">
<section class="grid grid--large">
<div class="textfield">
<input type="text" class="question" name="question" placeholder="Type your question here" required><br>
<input type="text" class="question" name="question" placeholder="Type your question here" required>
</div>
</section>
<br>
@for ($i = 0; $i < 5; $i++)
<section class="grid grid--large">
<div class="textfield">
@ -25,7 +27,52 @@
</div>
</section>
@endfor
<section class="grid grid--large">
<div class="some-top-margin">
<label class="checkbox no-bottom-margin">
<input type="checkbox" name="multiple_answers_allowed">
<span class="checkbox__label">Allow multiple answers</span>
</label>
<br>
<label class="checkbox no-bottom-margin">
<input type="checkbox" name="automatically_close_poll">
<span class="checkbox__label">Automatically close poll at </span>
<input type="datetime-local" name="automatically_close_poll_datetime" class="inline-block" value="{{ Carbon\Carbon::now()->addHour()->format('Y-m-d\TH:i') }}" min="{{ Carbon\Carbon::now()->format('Y-m-d\TH:i') }}">
</label>
<br>
<label class="checkbox no-bottom-margin">
<input type="checkbox" name="set_admin_password" checked=off>
<span class="checkbox__label">Set an admin password: </span>
<input type="text" name="admin_password" class="inline-text">
<span class="post-input-label"></span>
</label>
</div>
<div class="some-top-margin">
<div class="some-bottom-margin">
<span>Duplicate vote checking:</span>
</div>
<label class="radio no-bottom-margin">
<input type="radio" name="duplicate_vote_checking" value="none" checked>
<span class="radio__label">None</span>
</label>
<br>
<label class="radio no-bottom-margin">
<input type="radio" name="duplicate_vote_checking" value="cookies">
<span class="radio__label">Browser cookies</span>
</label>
<br>
<label class="radio no-bottom-margin">
<input type="radio" name="duplicate_vote_checking" value="codes">
<span class="radio__label">Voting codes</span>
</label>
<br>
<label class="number">
<input type="number" min="2" max="1000" value="10" name="number_of_codes">
<span class="radio__label">codes</span>
</label>
</div>
</section>
<section>
<input type="submit" class="btn" value="Create poll">

View File

@ -10,18 +10,95 @@
<style>
input[type="text"] { padding-top: 0.8rem!important; }
.no-top-padding { padding-top: 0!important; }
.no-bottom-margin { margin-bottom: 0!important; }
.some-bottom-margin { margin-bottom: 0.5rem!important; }
.some-bottom-padding { padding-bottom: 3rem!important; }
.some-top-margin { margin-top: 2.0rem; }
.inline-block { display: inline-block; }
.ta-center {
margin-top: 1rem;
}
.post-input-label {
display: inline-block;
font-size: 1.2rem;
}
.number {
display: inline-block;
margin-bottom: 2.4rem;
padding: 0 1rem 0 2rem;
position: relative;
}
.number > input[type="number"] {
display: inline-block;
border: 1px solid #7d7d7e;
margin-top: 0.5rem;
margin-left: 1rem;
}
.number > input[type="number"]:focus {
border-color: #e83fb8;
box-shadow: 0 1px 2px 0 #dededf inset;
outline: 0;
}
input[type="datetime-local"] {
margin-top: 0.2rem;
margin-bottom: 0.2rem;
font-size: 1.3rem;
padding: 0.2rem 0.5rem 0 0.5rem!important;
display: inline-block;
border: 1px solid #7d7d7e;
}
input[type="datetime-local"]:focus {
border-color: #e83fb8;
box-shadow: 0 1px 2px 0 #dededf inset;
outline: 0;
}
/* TODO: Fix footer: should stick to bottom (with some padding/margin at the bottom) and centered */
body {
min-height: initial;
}
footer, footer > * {
display: flex;
justify-content: center;
padding-bottom: 0;
}
input.inline-text[type="text"] {
margin-top: 0.2rem;
margin-bottom: 0.2rem;
padding: 0.2rem 0.5rem 0 0.5rem!important;
font-size: 1.3rem;
display: inline-block;
border: 1px solid #7d7d7e;
}
input.inline-text[type="text"]:focus {
border-color: #e83fb8;
box-shadow: 0 1px 2px 0 #dededf inset;
outline: 0;
}
</style>
</head>
<body>
<header class="wrapper ta-center">
<h1>@yield('title') - {{ config('app.name') }}</h1>
<header class="ta-center">
<h1>@yield('title')</h1>
</header>
<section class="wrapper-large no-top-padding">
<main class="dick wrapper-large no-top-padding some-bottom-padding">
@yield('content')
</section>
</main>
<footer>
<p>Dates and times are UTC.</p>
</footer>
</body>
</html>