made the question titles on test show view expandable to show question and options
This commit is contained in:
parent
12f6d58099
commit
d2aaf8addc
4 changed files with 77 additions and 14 deletions
app/Http/Controllers
public/css
resources/views
|
@ -28,7 +28,7 @@ class AdministrativeTestController extends Controller
|
|||
{
|
||||
$this->authorize('view', $test);
|
||||
|
||||
$questions = $test->questions;
|
||||
$questions = Question::where("test_id", $test->id)->with("options")->get();
|
||||
return view('tests.show', compact('test'), compact('questions'));
|
||||
}
|
||||
|
||||
|
|
29
public/css/app.css
vendored
Normal file
29
public/css/app.css
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
#accordion a {
|
||||
color:black;
|
||||
}
|
||||
|
||||
#accordion .panel-heading form {
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
#accordion .panel-default .panel-heading {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
#accordion .panel-default:first-child {
|
||||
margin: 2em 2em 1em 2em;
|
||||
}
|
||||
|
||||
#accordion .panel-default {
|
||||
box-shadow: unset;
|
||||
margin: 1em 2em 1em 2em;
|
||||
}
|
||||
|
||||
#accordion .list-group .list-group-item {
|
||||
margin-left: 2em;
|
||||
margin-right: 2em;
|
||||
}
|
||||
|
||||
#accordion .list-group .list-group-item:first-child {
|
||||
border: unset;
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="/css/app.css">
|
||||
|
||||
<!-- Scripts
|
||||
<script>
|
||||
|
|
|
@ -27,6 +27,39 @@
|
|||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">Questions</h4>
|
||||
</div>
|
||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
||||
@foreach ($questions as $question)
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" role="tab" id="heading{{ $question->id }}">
|
||||
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse{{ $question->id }}" aria-expanded="false" aria-controls="collapse{{$question->id}}">
|
||||
{{ $question->title }} <span class="caret"></span>
|
||||
</a>
|
||||
@if (Auth::user()->isAdministrator() || (Auth::user()->isModerator() AND $test->group_id === Auth::user()->group_id))
|
||||
<form method="get" class="pull-right">
|
||||
<button class="btn btn-sm btn-default pull-left" formaction="/{{ Auth::user()->getAdminPath() }}/questions/{{ $question->id }}/edit">Edit</button>
|
||||
<button class="btn btn-sm btn-danger pull-left" formaction="/{{ Auth::user()->getAdminPath() }}/questions/{{ $question->id }}/delete">Delete</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
<div id="collapse{{ $question->id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{{ $question->id }}">
|
||||
<div class="panel-body">
|
||||
{{ $question->question }}
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
@foreach ($question->options as $option)
|
||||
<li class="list-group-item">{{ $option->option }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="panel panel-default">
|
||||
<div class="panel-heading">Questions</div>
|
||||
<div class="panel-body">
|
||||
<table class="table">
|
||||
|
@ -42,22 +75,22 @@
|
|||
</th>
|
||||
</tr>
|
||||
@foreach ($questions as $question)
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>{{ $question->title }}</td>
|
||||
<td>
|
||||
@if (Auth::user()->isAdministrator() || (Auth::user()->isModerator() AND $test->group_id === Auth::user()->group_id))
|
||||
<form method="get" class="pull-right">
|
||||
<button class="btn btn-sm btn-default pull-left" formaction="/{{ Auth::user()->getAdminPath() }}/questions/{{ $question->id }}/edit">Edit</button>
|
||||
<button class="btn btn-sm btn-danger pull-left" formaction="/{{ Auth::user()->getAdminPath() }}/questions/{{ $question->id }}/delete">Delete</button>
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>{{ $question->title }}</td>
|
||||
<td>
|
||||
@if (Auth::user()->isAdministrator() || (Auth::user()->isModerator() AND $test->group_id === Auth::user()->group_id))
|
||||
<form method="get" class="pull-right">
|
||||
<button class="btn btn-sm btn-default pull-left" formaction="/{{ Auth::user()->getAdminPath() }}/questions/{{ $question->id }}/edit">Edit</button>
|
||||
<button class="btn btn-sm btn-danger pull-left" formaction="/{{ Auth::user()->getAdminPath() }}/questions/{{ $question->id }}/delete">Delete</button>
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue