diff options
| author | Camil Staps | 2017-09-20 19:36:37 +0200 | 
|---|---|---|
| committer | Camil Staps | 2017-09-20 19:36:37 +0200 | 
| commit | 6eb9f640687a0992b3581eaf0b97a9dfe883d1cd (patch) | |
| tree | f56580cbf713ae7bd1ee2cb5582fea0e61a67f95 | |
| parent | Merge branch 'master' of github.com:HebrewTools/ParseTrainer (diff) | |
Use <select> for root again; fix checking answers
| -rw-r--r-- | public/js/hebrewparsetrainer.js | 8 | ||||
| -rw-r--r-- | resources/views/trainer.blade.php | 8 | 
2 files changed, 10 insertions, 6 deletions
| diff --git a/public/js/hebrewparsetrainer.js b/public/js/hebrewparsetrainer.js index db51117..507677b 100644 --- a/public/js/hebrewparsetrainer.js +++ b/public/js/hebrewparsetrainer.js @@ -152,7 +152,7 @@ $(document).ready(function(){  		var stems = $('input[name="stem"]:checked').map(function(){return this.value;});  		var tenses = $('input[name="tense"]:checked').map(function(){return this.value;}); -		var roots = $('input[name="root"]:checked').map(function(){return this.value;}); +		var roots = $('select[name="root"]').val();  		$.ajax('verb/random/', {  			method: 'POST', @@ -293,7 +293,11 @@ $(document).ready(function(){  		for (var i in correct_answers) {  			var correct_answer = correct_answers[i]; -			if (JSON.stringify(answer) == JSON.stringify(correct_answer)) { +			var root = correct_answer['root']; +			delete correct_answer['root']; +			var json = JSON.stringify(correct_answer); +			correct_answer['root'] = root; +			if (JSON.stringify(answer) == json) {  				$('#trainer-input-'+input_count)  					.css({backgroundColor: '#dff0d8'})  					.parent().addClass('has-success'); diff --git a/resources/views/trainer.blade.php b/resources/views/trainer.blade.php index 59e457a..2d2ae25 100644 --- a/resources/views/trainer.blade.php +++ b/resources/views/trainer.blade.php @@ -30,13 +30,13 @@ use HebrewParseTrainer\Tense;  	<div class="form-group">  		<h3>Roots</h3> -		@foreach (Root::orderBy('root_kind_id')->get() as $root) +		<select name="root" class="reload-verb form-control hebrew ltr" multiple="multiple"> +		@foreach (Root::orderBy('root_kind_id')->orderBy('root')->get() as $root)  			@if ($root->verbs()->where('active', 1)->count() > 0) -				<div class="checkbox"> -					<label><input class="reload-verb" type="checkbox" name="root" value="{{{ $root->root }}}" checked="checked"/> <span class="hebrew">{{{ $root->root }}}</span> ({{{ $root->kind->name }}})</label> -				</div> +					<option value="{{{ $root->root }}}" selected="selected">{{{ $root->root }}} ({{{ $root->kind->name }}})</option>  			@endif  		@endforeach +		</select>  	</div>  	<div class="form-group"> | 
