Add post-creation info box
This commit is contained in:
parent
a2d2d6e557
commit
12a87f7611
|
@ -18,6 +18,9 @@ class PollController extends Controller
|
|||
return view('create_poll');
|
||||
}
|
||||
|
||||
//TODO: Close polls
|
||||
//TODO: Implement poll editing
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
if($request->has('options')) {
|
||||
|
|
|
@ -16,19 +16,21 @@
|
|||
|
||||
<br>
|
||||
|
||||
@for ($i = 0; $i < 5; $i++)
|
||||
<section class="grid grid--large">
|
||||
<div class="textfield">
|
||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option" @if($i == 0 ) required @endif>
|
||||
<section>
|
||||
@for ($i = 0; $i < 5; $i++)
|
||||
<div class="grid grid--large">
|
||||
<div class="textfield">
|
||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option" @if($i == 0 ) required @endif>
|
||||
</div>
|
||||
<div class="textfield">
|
||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option" @if($i == 0 ) required @endif>
|
||||
</div>
|
||||
<div class="textfield">
|
||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option">
|
||||
</div>
|
||||
</div>
|
||||
<div class="textfield">
|
||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option" @if($i == 0 ) required @endif>
|
||||
</div>
|
||||
<div class="textfield">
|
||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option">
|
||||
</div>
|
||||
</section>
|
||||
@endfor
|
||||
@endfor
|
||||
</section>
|
||||
|
||||
<section class="grid grid--large">
|
||||
<div class="some-top-margin">
|
||||
|
|
|
@ -16,6 +16,26 @@
|
|||
.some-top-margin { margin-top: 2.0rem; }
|
||||
.inline-block { display: inline-block; }
|
||||
|
||||
.primary-box {
|
||||
padding: 1rem 1rem 1rem 1rem!important;
|
||||
border: 2px solid #e83fb8;
|
||||
}
|
||||
|
||||
.copyarea {
|
||||
user-select: all;
|
||||
width: calc(100% - 0.4rem);
|
||||
height: 15rem;
|
||||
margin-top: 0.5rem;
|
||||
border: 1px solid #7d7d7e;
|
||||
font-family: "Roboto Mono", monospace;
|
||||
font-size: 1rem;
|
||||
padding: 0 0rem 0 0.4rem;
|
||||
}
|
||||
|
||||
.copyarea:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.ta-center {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
|
|
@ -7,34 +7,51 @@ $type = $poll->allow_multiple_answers ? "checkbox" : "radio";
|
|||
@endphp
|
||||
|
||||
@section('content')
|
||||
@if($hasVoted)
|
||||
<section>
|
||||
<span>You have already voted on this poll.</span>
|
||||
@if ($new)
|
||||
<section class="primary-box">
|
||||
<span>Your poll has been created!</span><br>
|
||||
|
||||
<br>
|
||||
|
||||
@if($poll->results_visible)
|
||||
<div class="some-top-margin">
|
||||
<span><a href="{{ action('PollController@viewResults', ['poll' => $poll]) }}">Results</a></span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="some-top-margin">
|
||||
@if ($poll->duplicate_vote_checking == 'codes')
|
||||
<span>Voting URLs:</span>
|
||||
<textarea class="copyarea" readonly>{{$poll->voting_codes()->get()->map(function($c) use($poll) { return action('PollController@view', ['poll' => $poll, 'code' => $c]); })->implode("\n")}}</textarea>
|
||||
@else
|
||||
<span>Poll URL: <a href="{{ action('PollController@view', ['poll' => $poll]) }}"{{ action('PollController@view', ['poll' => $poll]) }}></a></span>
|
||||
@endif
|
||||
</div>
|
||||
</section>
|
||||
@else
|
||||
<form action"={{ action('PollController@vote', ['poll' => $poll]) }}" method="post">
|
||||
@csrf
|
||||
|
||||
@foreach ($poll->options as $option)
|
||||
<label class="{{$type}} no-bottom-margin">
|
||||
<input type="{{$type}}" name="options[]" value="{{$option->id}}">
|
||||
<span class="{{$type}}__label">{{$option->text}}</span>
|
||||
</label>
|
||||
|
||||
<br>
|
||||
@endforeach
|
||||
|
||||
<section class="some-top-margin">
|
||||
<input type="submit" class="btn" value="Submit vote">
|
||||
</section>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
<section @if($new) class="some-top-margin" @endif>
|
||||
@if ($hasVoted)
|
||||
@if (!$new || $poll->duplicate_vote_checking != 'codes')
|
||||
<span>You have already voted on this poll or need a code to vote.</span>
|
||||
|
||||
<br>
|
||||
|
||||
@if ($poll->results_visible)
|
||||
<div class="some-top-margin">
|
||||
<span><a href="{{ action('PollController@viewResults', ['poll' => $poll]) }}">Results</a></span>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@else
|
||||
<form action="{{ action('PollController@vote', ['poll' => $poll]) }}" method="post">
|
||||
@csrf
|
||||
|
||||
@foreach ($poll->options as $option)
|
||||
<label class="{{$type}} no-bottom-margin">
|
||||
<input type="{{$type}}" name="options[]" value="{{$option->id}}">
|
||||
<span class="{{$type}}__label">{{$option->text}}</span>
|
||||
</label>
|
||||
|
||||
<br>
|
||||
@endforeach
|
||||
|
||||
<div class="some-top-margin">
|
||||
<input type="submit" class="btn" value="Submit vote">
|
||||
</div>
|
||||
</form>
|
||||
@endif
|
||||
</section>
|
||||
@endsection
|
||||
|
|
Loading…
Reference in New Issue