Skip to content

Commit

Permalink
Authorization
Browse files Browse the repository at this point in the history
changed some things to cdn
  • Loading branch information
zalsader committed Sep 14, 2015
1 parent 4f0dbc2 commit 787d58e
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 12 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class SubmissionController extends Controller
public function index($questionId)
{
$question = Question::findOrFail($questionId);
$this->authorize('grade', $question);
$submissions = $question->submissions;
return view('submissions.index')->with(compact(['question', 'submissions']));
}
Expand Down Expand Up @@ -59,6 +60,7 @@ public function submit(Request $request, $questionId)
public function show($questionId, $id)
{
$question = Question::findOrFail($questionId);
$this->authorize('grade', $question);
$submission = Submission::findOrFail($id);
return view('submissions.show')->with(compact(['question', 'submission']));
}
Expand Down
10 changes: 9 additions & 1 deletion app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ public function boot(GateContract $gate)
{
parent::registerPolicies($gate);

//
$gate->define('grade', function ($user, $a) {
return $user->is_grader == 1;
});

$gate->before(function ($user, $ability) {
if ($user->isSuperAdmin()) {
return true;
}
});
}
}
5 changes: 5 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
margin-left: 2.5%;
margin-top: 10px;
}

.hidden {
visibility: none;
display: none;
}
Binary file removed public/game/media/click.mp3
Binary file not shown.
Binary file removed public/game/media/click.ogg
Binary file not shown.
Binary file removed public/game/media/click.wav
Binary file not shown.
Binary file removed public/game/media/click1.mp3
Binary file not shown.
Binary file removed public/game/media/click1.ogg
Binary file not shown.
Binary file removed public/game/media/click1.wav
Binary file not shown.
Binary file removed public/game/media/delete.mp3
Binary file not shown.
Binary file removed public/game/media/delete.ogg
Binary file not shown.
Binary file removed public/game/media/delete.wav
Binary file not shown.
Binary file removed public/game/media/delete1.mp3
Binary file not shown.
Binary file removed public/game/media/delete1.ogg
Binary file not shown.
12 changes: 6 additions & 6 deletions resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<html>
<head>
<title>Think Like A Programmer</title>
<link href="{{asset('css/bootstrap.min.css')}}" media="all" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" media="all" rel="stylesheet" />
<link href="{{asset('css/style.css')}}" media="all" rel="stylesheet" />
<link href="{{asset('css/jquery-ui.min.css')}}" media="all" rel="stylesheet" />
<link href="{{asset('css/jquery-ui.theme.min.css')}}" media="all" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.css" media="all" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.theme.min.css" media="all" rel="stylesheet" />
<meta name="_token" content="{!! csrf_token() !!}"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
Expand Down Expand Up @@ -33,9 +33,9 @@
<hr class="clear">
@yield('content')

<script type="text/javascript" src="{{asset('js/jquery.min.js')}}"></script>
<script type="text/javascript" src="{{asset('js/jquery-ui.min.js')}}"></script>
<script type="text/javascript" src="{{asset('js/bootstrap.min.js')}}"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{{asset('js/measurement.js')}}"></script>
<script type="text/javascript">
$.ajaxSetup({
Expand Down
2 changes: 1 addition & 1 deletion resources/views/embrace.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>Think Like A Programmer</title>
<link href="{{asset('css/bootstrap.min.css')}}" media="all" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" media="all" rel="stylesheet" />
</head>
<body>
<center>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/questions/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<p>{{ $question->description }}</p>
</div>
<div class="col-md-6">
<div width="400" height="400" style="position: relative;">
<div width="400" height="0" style="position: relative;">
<img src="{{asset('images/questions/'.$question->image)}}" alt="">
<canvas id="measure" width="400" height="400"
<canvas id="measure" width="400" height="0"
style="position: absolute; left: 0; top: 0; z-index: 1;"></canvas>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/submissions/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
</div>
</div>
</div>

<!-- TODO diff & assess -->
</div>

<iframe class="game" src="{{url('/game/apps/turtle/index.html?blocks='.$submission->blocks)}}" width="95%" height="655" sandbox="allow-same-origin allow-scripts"></iframe>
<iframe class="game" src="{{'https://thinklikeaprogrammer.appspot.com/static/apps/turtle/index.html?blocks='.$submission->blocks}}" width="95%" height="655" sandbox="allow-same-origin allow-scripts"></iframe>

@stop

Expand Down

0 comments on commit 787d58e

Please sign in to comment.