diff options
| author | Camil Staps | 2016-09-05 22:30:47 +0200 | 
|---|---|---|
| committer | Camil Staps | 2016-09-05 22:30:47 +0200 | 
| commit | fc5cef0efddbb1141b0a371108a23fc7f6e8d860 (patch) | |
| tree | 8b3e62b50e5f856c57af477a78a51567d6e859f2 /resources/views | |
| parent | User creation and authentication (diff) | |
Vote on verb suggestions
Diffstat (limited to 'resources/views')
| -rw-r--r-- | resources/views/contribute.blade.php | 35 | ||||
| -rw-r--r-- | resources/views/layouts/master.blade.php | 33 | ||||
| -rw-r--r-- | resources/views/stats.blade.php | 51 | ||||
| -rw-r--r-- | resources/views/suggest.blade.php | 76 | ||||
| -rw-r--r-- | resources/views/suggestions.blade.php | 32 | 
5 files changed, 184 insertions, 43 deletions
| diff --git a/resources/views/contribute.blade.php b/resources/views/contribute.blade.php new file mode 100644 index 0000000..4c3b6de --- /dev/null +++ b/resources/views/contribute.blade.php @@ -0,0 +1,35 @@ +@extends('layouts.master') + +@section('master-content') +<p class="lead"> +	Thank you for wanting to help out! To expand our database, we are looking for volunteers to enter more verbs. +</p> + +@if(!Auth::check()) +	<a class="btn btn-lg btn-primary" href="{{ env('APP_URL') }}contribute?login=yes">Login</a> +	<a class="btn btn-lg btn-success" href="{{ env('APP_URL') }}user/create">Sign up</a> +@endif + +<h3>Here's how it works:</h3> + +<ul> +	<li>Any user can <em>suggest new verbs</em>.</li> +	<li>These have to be <em>peer-reviewed</em> by other contributors.</li> +	<li>It has to get <em>five</em> votes to be accepted.</li> +	<li>Contributors <em>earn points</em> for all accepted verbs they suggested.</li> +	<li>The <em>vote weight</em> is dependent on the number of points a user has.</li> +</ul> + +@if(Auth::check()) +	<hr/> +	<div class="row"> +		<div class="col-lg-6"> +			@include('suggestions') +		</div> +		<div class="col-lg-6"> +			@include('suggest') +		</div> +	</div> +@endif + +@endsection diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index 3c111da..199db2d 100644 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -16,17 +16,43 @@ GNU General Public License for more details.  You should have received a copy of the GNU General Public License  along with this program.  If not, see <http://www.gnu.org/licenses/>.   --> +<?php +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Request; + +$activePage = isset($activePage) ? $activePage : ''; +$menu = [ +	'Train' => ['/', ''], +	'Contribute' => ['contribute', 'contribute'], +]; + +if (Auth::check()) { +	$menu['Statistics'] = ['stats', 'stats']; +	$menu['Logout'] = ['logout', 'logout']; +} +?>  <html lang="en">  	<head>  		<meta charset="utf-8">  		<title>ParseTrainer</title>  		<link rel="stylesheet" href="{{ env('APP_URL') }}vendor/twbs/bootstrap/dist/css/bootstrap.min.css">  		<link rel="stylesheet" href="{{ env('APP_URL') }}public/css/hebrewparsetrainer.css"> + +		<script type="text/javascript"> +			var app_url = '{{ env('APP_URL') }}'; +		</script>  	</head>  	<body role="application">  		<div class="container" role="main"> -			<div class="page-header"> -				<h1>ParseTrainer</h1> +			<div class="header clearfix"> +				<nav> +					<ul class="nav nav-pills pull-right"> +						@foreach($menu as $name => $link) +							<li role="presentation" class="{{ Request::is($link[0]) ? 'active' : '' }}"><a href="{{ env('APP_URL') }}{{ $link[1] }}">{{ $name }}</a></li> +						@endforeach +					</ul> +				</nav> +				<h2 class="text-muted">ParseTrainer</h2>  			</div>  			@yield('master-content') @@ -35,5 +61,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  		<script src="{{ env('APP_URL') }}vendor/components/jquery/jquery.min.js"></script>  		<script src="{{ env('APP_URL') }}vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>  		<script src="{{ env('APP_URL') }}public/js/hebrewparsetrainer.js"></script> +		@if(Auth::check()) +			<script src="{{ env('APP_URL') }}public/js/moderators.js"></script> +		@endif  	</body>  </html> diff --git a/resources/views/stats.blade.php b/resources/views/stats.blade.php index f68c9ac..04fabfe 100644 --- a/resources/views/stats.blade.php +++ b/resources/views/stats.blade.php @@ -1,42 +1,3 @@ -<!DOCTYPE html> -<!-- -HebrewParseTrainer - practice Hebrew verbs -Copyright (C) 2015  Camil Staps <info@camilstaps.nl> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program.  If not, see <http://www.gnu.org/licenses/>. - --> -<html lang="en"> -<head> -	<meta charset="utf-8"> -	<title>ParseTrainer statistics</title> -	<link rel="stylesheet" href="{{ url("/vendor/twbs/bootstrap/dist/css/bootstrap.min.css") }}"> -	<link rel="stylesheet" href="{{ url("/vendor/twbs/bootstrap/dist/css/bootstrap-theme.min.css") }}"> -	<link rel="stylesheet" href="{{ url("/public/css/hebrewparsetrainer.css") }}"> -</head> -<body role="application"> -<div class="container" role="main"> -	<div class="page-header"> -		<h1>ParseTrainer statistics</h1> -	</div> - -	<div class="row"> -		<div class="col-md-12"> -			<div id="statistics" style="height:400px;"></div> -		</div> -	</div> -</div> -  <?php  use \HebrewParseTrainer\RandomLog; @@ -53,6 +14,15 @@ foreach ($db_stats as $stat) {  $stats = "[" . implode(",", $stats) . "]";  ?> +@extends('layouts.master') + +@section('master-content') +<div class="row"> +	<div class="col-md-12"> +		<div id="statistics" style="height:400px;"></div> +	</div> +</div> +  <script src="{{ url("/vendor/components/jquery/jquery.min.js") }}"></script>  <script src="{{ url("/vendor/twbs/bootstrap/dist/js/bootstrap.min.js") }}"></script>  <script src="//code.highcharts.com/stock/highstock.js"></script> @@ -105,5 +75,4 @@ $stats = "[" . implode(",", $stats) . "]";  		]  	});  </script> -</body> -</html> +@endsection diff --git a/resources/views/suggest.blade.php b/resources/views/suggest.blade.php new file mode 100644 index 0000000..6a1ebe8 --- /dev/null +++ b/resources/views/suggest.blade.php @@ -0,0 +1,76 @@ +<?php +use HebrewParseTrainer\Root; +use HebrewParseTrainer\Tense; +use HebrewParseTrainer\Verb; +?> +<div class="panel panel-default"> +	<div class="panel-heading"> +		<h3 class="panel-title">Suggest a new verb</h3> +	</div> +	<div class="panel-body"> +		<form class="form-horizontal"> +			<div class="form-group"> +				<label for="suggest-verb" class="col-sm-2 control-label">Verb</label> +				<div class="col-sm-10"> +					<input type="text" class="form-control" id="suggest-verb" placeholder="קָטַל"/> +				</div> +			</div> +			<div class="form-group"> +				<label for="suggest-root" class="col-sm-2 control-label">Root</label> +				<div class="col-sm-10"> +					<select id="suggest-root" class="form-control"> +						@foreach(Root::all() as $root) +							<option value="{{ $root->id }}">{{{ $root->root }}}</option> +						@endforeach +					</select> +				</div> +			</div> +			<div class="form-group"> +				<label for="suggest-tense" class="col-sm-2 control-label">Tense</label> +				<div class="col-sm-10"> +					<select id="suggest-tense" class="form-control"> +						@foreach(Tense::all() as $tense) +							<option value="{{ $tense->id }}">{{{ $tense->abbreviation }}}: {{{ $tense->name }}}</option> +						@endforeach +					</select> +				</div> +			</div> +			<div class="form-group"> +				<label for="suggest-person" class="col-sm-2 control-label">Person</label> +				<div class="col-sm-10"> +					<select id="suggest-person" class="form-control"> +						<option value="">(none)</option> +						<option value="1">1</option> +						<option value="2">2</option> +						<option value="3">3</option> +					</select> +				</div> +			</div> +			<div class="form-group"> +				<label for="suggest-gender" class="col-sm-2 control-label">Gender</label> +				<div class="col-sm-10"> +					<select id="suggest-gender" class="form-control"> +						<option value="">(none)</option> +						<option value="m">masculine</option> +						<option value="f">feminine</option> +					</select> +				</div> +			</div> +			<div class="form-group"> +				<label for="suggest-number" class="col-sm-2 control-label">Number</label> +				<div class="col-sm-10"> +					<select id="suggest-number" class="form-control"> +						<option value="">(none)</option> +						<option value="s">singular</option> +						<option value="p">plural</option> +					</select> +				</div> +			</div> +			<div class="form-group"> +				<div class="col-sm-offset-2 col-sm-10"> +					<button type="submit" class="btn btn-primary">Suggest</button> +				</div> +			</div> +		</form> +	</div> +</div> diff --git a/resources/views/suggestions.blade.php b/resources/views/suggestions.blade.php new file mode 100644 index 0000000..dcec56a --- /dev/null +++ b/resources/views/suggestions.blade.php @@ -0,0 +1,32 @@ +<?php +use HebrewParseTrainer\Verb; +?> +<div class="panel panel-default"> +	<div class="panel-heading"> +		<h3 class="panel-title">Current suggestions</h3> +	</div> +	<div class="panel-body"> +		<table class="table table-hover table-condensed suggestions"> +			<tr> +				<th>Verb</th> +				<th>Root</th> +				<th>Parsing</th> +				<th>Votes</th> +			</tr> +			@forelse(Verb::where('active', 0)->orderBy('verb')->get() as $verb) +				<tr> +					<td class="large">{{ $verb->verb }}</td> +					<td class="large">{{ $verb->root }}</td> +					<td>{{ $verb->stem }} {{ $verb->tense }} {{ $verb->person }}{{ $verb->gender }}{{ $verb->number }}</td> +					<td> +						<button data-vote="0" data-verb="{{ $verb->id }}" class="vote btn btn-{{ $verb->userVote(Auth::user()) < 0 ? 'danger' : 'default' }}">-</button> +						<span class="vote-count btn">{{ $verb->voteCount() }}</span> +						<button data-vote="1" data-verb="{{ $verb->id }}" class="vote btn btn-{{ $verb->userVote(Auth::user()) > 0 ? 'success' : 'default' }}">+</button> +					</td> +				</tr> +			@empty +				<tr><td colspan="4">There are no active suggestions. Why not add a verb yourself?</td></tr> +			@endforelse +		</table> +	</div> +</div> | 
