Skip to content

Commit

Permalink
added ACE editor
Browse files Browse the repository at this point in the history
  • Loading branch information
keefo committed May 3, 2015
1 parent f43a5f6 commit d5d89a4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -28,7 +28,7 @@ This is the 3rd version of NUC Online Judge system. The new system build on [Lar

## License

CATweaker & CATweakerSense is published under MIT License
NOJ is published under MIT License

Copyright (c) 2015 Xu Lian (@lianxu)

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/SubmitController.php
Expand Up @@ -69,7 +69,7 @@ public function code($submit_id)
return redirect()->guest('auth/login');
}

$submit = Submit::select('submits.*', 'users.name', 'users.screen_name', 'problems.title', 'problems.slug', DB::raw('UNCOMPRESS(codes.source_code) as code'))->
$submit = Submit::select('submits.*', 'users.username', 'users.screen_name', 'problems.title', 'problems.slug', DB::raw('UNCOMPRESS(codes.source_code) as code'))->
leftjoin('codes', 'codes.id', '=', 'submits.code_id')->
leftjoin('problems', 'problems.id', '=', 'submits.problem_id')->
leftjoin('users', 'users.id', '=', 'submits.user_id')->
Expand Down
1 change: 1 addition & 0 deletions resources/views/app.blade.php
Expand Up @@ -103,6 +103,7 @@
<!-- Scripts -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace.js"></script>

@yield('scripts', '')

Expand Down
22 changes: 18 additions & 4 deletions resources/views/submits/show.blade.php
@@ -1,7 +1,6 @@
@extends('app')

@section('content')

<div class="container">
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
Expand All @@ -13,8 +12,8 @@
<div class="container problem">

<div class="page-header text-center">
<h2><a href="{{ url('/users', $submit->name) }}" target="_blank">{{ $submit->screen_name }}</a></h2>
<h4><a href="{{ url('/problems', $submit->slug) }}" target="_blank">{{ $submit->title }}</a></h4>
<h2><a href="{{ url('/problems', $submit->slug) }}" target="_blank">{{ $submit->title }}</a></h2>
<h4>By <a href="{{ url('/users', $submit->name) }}" target="_blank">{{ $submit->screen_name }}</a></h4>
<h5>
<span class="text-muted">Time:</span> {{ $submit->time }}ms
&nbsp;&nbsp;&nbsp;
Expand All @@ -25,9 +24,24 @@

<div class="row">
<div class="col-md-12">
<pre>{{ $submit->code }}</pre>
<pre id="code">{{ $submit->code }}</pre>
</div>
</div>

</div>
@endsection


@section('scripts')
<script>
$(function(){
var editor = ace.edit("code");
editor.setOptions({
maxLines: Infinity
});
editor.setReadOnly(true);
editor.setTheme("ace/theme/theme-github");
editor.getSession().setMode("ace/mode/c_cpp");
});
</script>
@stop

0 comments on commit d5d89a4

Please sign in to comment.