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');
|
return view('create_poll');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Close polls
|
||||||
|
//TODO: Implement poll editing
|
||||||
|
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
if($request->has('options')) {
|
if($request->has('options')) {
|
||||||
|
|
|
@ -16,19 +16,21 @@
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@for ($i = 0; $i < 5; $i++)
|
<section>
|
||||||
<section class="grid grid--large">
|
@for ($i = 0; $i < 5; $i++)
|
||||||
<div class="textfield">
|
<div class="grid grid--large">
|
||||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option" @if($i == 0 ) required @endif>
|
<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>
|
||||||
<div class="textfield">
|
@endfor
|
||||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option" @if($i == 0 ) required @endif>
|
</section>
|
||||||
</div>
|
|
||||||
<div class="textfield">
|
|
||||||
<input type="text" class="option" name="options[]" placeholder="Enter a poll option">
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
@endfor
|
|
||||||
|
|
||||||
<section class="grid grid--large">
|
<section class="grid grid--large">
|
||||||
<div class="some-top-margin">
|
<div class="some-top-margin">
|
||||||
|
|
|
@ -16,6 +16,26 @@
|
||||||
.some-top-margin { margin-top: 2.0rem; }
|
.some-top-margin { margin-top: 2.0rem; }
|
||||||
.inline-block { display: inline-block; }
|
.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 {
|
.ta-center {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,34 +7,51 @@ $type = $poll->allow_multiple_answers ? "checkbox" : "radio";
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@if($hasVoted)
|
@if ($new)
|
||||||
<section>
|
<section class="primary-box">
|
||||||
<span>You have already voted on this poll.</span>
|
<span>Your poll has been created!</span><br>
|
||||||
|
|
||||||
<br>
|
<div class="some-top-margin">
|
||||||
|
@if ($poll->duplicate_vote_checking == 'codes')
|
||||||
@if($poll->results_visible)
|
<span>Voting URLs:</span>
|
||||||
<div class="some-top-margin">
|
<textarea class="copyarea" readonly>{{$poll->voting_codes()->get()->map(function($c) use($poll) { return action('PollController@view', ['poll' => $poll, 'code' => $c]); })->implode("\n")}}</textarea>
|
||||||
<span><a href="{{ action('PollController@viewResults', ['poll' => $poll]) }}">Results</a></span>
|
@else
|
||||||
</div>
|
<span>Poll URL: <a href="{{ action('PollController@view', ['poll' => $poll]) }}"{{ action('PollController@view', ['poll' => $poll]) }}></a></span>
|
||||||
@endif
|
@endif
|
||||||
|
</div>
|
||||||
</section>
|
</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
|
@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
|
@endsection
|
||||||
|
|
Loading…
Reference in New Issue