Add click handling to the word details table

This commit is contained in:
Leonard Smith 2020-10-08 12:35:38 -05:00
parent f89cafa4d7
commit 1458fa70cc
3 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<tr data-strongs={{@model.strongsNumber}} class="{{this.selected}}" ...attributes>
<tr {{on "click" (fn this.select @model)}} class="{{this.selected}}" ...attributes>
<td>{{@model.greek}}</td>
<td>{{@model.ulb}}</td>
<td>{{@model.morph}}</td>

View File

@ -1,12 +1,19 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class WordsWordRowComponent extends Component {
@service('word-select') selectedWord;
@service('word-select') selectWord;
@action
select(word) {
this.selectWord.select(word);
}
get
selected() {
if(this.selectedWord.isCurrentByOgntId(this.args.model)) {
if(this.selectWord.isCurrentByOgntId(this.args.model)) {
return "selected";
} else {
return "";

View File

@ -6,6 +6,7 @@ table.word-details th,
table.word-details td {
border: 1px solid grey;
padding: 10px;
cursor: pointer;
}
table.word-details tr.selected {