diff options
-rw-r--r-- | app/Root.php | 4 | ||||
-rw-r--r-- | public/js/hebrewparsetrainer.js | 4 | ||||
-rw-r--r-- | resources/views/trainer.blade.php | 8 |
3 files changed, 11 insertions, 5 deletions
diff --git a/app/Root.php b/app/Root.php index 2e21c4e..4e5e9df 100644 --- a/app/Root.php +++ b/app/Root.php @@ -30,4 +30,8 @@ class Root extends Model { return $this->belongsTo('HebrewParseTrainer\RootKind', 'root_kind_id'); } + public function verbs() { + return $this->hasMany('HebrewParseTrainer\Verb', 'root', 'root'); + } + } diff --git a/public/js/hebrewparsetrainer.js b/public/js/hebrewparsetrainer.js index 292419d..e5666be 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/', { data: { @@ -333,7 +333,7 @@ $(document).ready(function(){ reloadVerb(); } - $('#hebrewparsetrainer-settings input.reload-verb').change(function(){ + $('#hebrewparsetrainer-settings .reload-verb').change(function(){ reloadVerb(); }); diff --git a/resources/views/trainer.blade.php b/resources/views/trainer.blade.php index 4c788f0..c4452f6 100644 --- a/resources/views/trainer.blade.php +++ b/resources/views/trainer.blade.php @@ -28,11 +28,13 @@ use HebrewParseTrainer\Tense; <div class="form-group"> <h3>Roots</h3> + <select name="root" class="reload-verb form-control" multiple="multiple"> @foreach (Root::orderBy('root_kind_id')->get() as $root) - <div class="checkbox"> - <label class="hebrew"><input class="reload-verb" type="checkbox" name="root" value="{{{ $root->root }}}" checked="checked"/> {{{ $root->root }}} ({{{ $root->kind->name }}})</label> - </div> + @if ($root->verbs()->where('active', 1)->count() > 0) + <option class="hebrew" value="{{{ $root->root }}}" selected="selected">{{{ $root->root }}} ({{{ $root->kind->name }}})</option> + @endif @endforeach + </select> </div> <div class="form-group"> |