Add votes to results page
This commit is contained in:
parent
fd99a98438
commit
382ba5f87c
|
@ -14,6 +14,7 @@
|
||||||
.some-bottom-margin { margin-bottom: 0.5rem!important; }
|
.some-bottom-margin { margin-bottom: 0.5rem!important; }
|
||||||
.some-bottom-padding { padding-bottom: 3rem!important; }
|
.some-bottom-padding { padding-bottom: 3rem!important; }
|
||||||
.some-top-margin { margin-top: 2.0rem; }
|
.some-top-margin { margin-top: 2.0rem; }
|
||||||
|
.some-more-bottom-margin { margin-bottom: 2.0rem; }
|
||||||
.inline-block { display: inline-block; }
|
.inline-block { display: inline-block; }
|
||||||
|
|
||||||
.primary-box {
|
.primary-box {
|
||||||
|
|
|
@ -10,10 +10,29 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($poll->results_visible)
|
@if($poll->results_visible)
|
||||||
<section class="grid grid--large @if($voted) some-top-margin @endif">
|
<section class="grid grid--large some-top-margin">
|
||||||
<div>
|
<div class="some-bottom-margin">
|
||||||
<div class="primary-box">
|
<div class="primary-box">
|
||||||
<span>TODO: Put results here.</span>
|
@php ($total = $poll->votes->count())
|
||||||
|
|
||||||
|
@foreach ($poll->options->sortByDesc(function($option) use($poll) { return $poll->votes->where('poll_option_id', $option->id)->count(); }) as $option)
|
||||||
|
@php ($votes = $poll->votes->where('poll_option_id', $option->id)->count())
|
||||||
|
|
||||||
|
<div class="some-more-bottom-margin">
|
||||||
|
<div>
|
||||||
|
<span>{{ $option->text }}</span>
|
||||||
|
<span style="float:right">{{ $votes }} votes</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div style="background-color:#e83fb8;height:2rem;width:{{ $votes / $total * 100 }}%;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<div class="some-top-margin">
|
||||||
|
<span>Total votes: {{ $total }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in New Issue