Add route and template for words

This commit is contained in:
Leonard Smith 2020-10-09 16:41:20 -05:00
parent a16861302e
commit 5ed6cee1ec
10 changed files with 29 additions and 7 deletions

View File

@ -1,3 +1,3 @@
<h4>Lexicon Entry</h4>
<h5>{{this.selectedWord.lexicalEntry.id}}: {{this.selectedWord.lexicalEntry.lemma}}</h5>
<p>{{markdown-to-html this.selectedWord.lexicalEntry.commentary}}</p>
<h5>{{@model.id}}: {{@model.lemma}}</h5>
<p>{{markdown-to-html @model.commentary}}</p>

View File

@ -1 +1 @@
<span class="{{this.selected}}" {{on "click" (fn this.select @model)}} data-strongs={{@model.strongs_number}} ...attributes>{{@model.greek}}</span>
<span class="{{this.selected}}" {{on "click" (fn this.select @model)}} ...attributes>{{@model.greek}}</span>

View File

@ -4,10 +4,12 @@ import { action } from '@ember/object';
export default class WordsGreekWordComponent extends Component {
@service('word-select') selectWord;
@service router;
@action
select(word) {
this.selectWord.select(word);
this.router.transitionTo('verse.word', word.strongsNumber);
}
get

View File

@ -7,5 +7,7 @@ export default class Router extends EmberRouter {
}
Router.map(function() {
this.route('verse', { path: '/verse/:verse_id' });
this.route('verse', { path: '/verse/:verse_id' }, function() {
this.route('word', { path: '/word/:word_id' });
});
});

View File

@ -2,7 +2,6 @@ import Route from '@ember/routing/route';
export default class VerseRoute extends Route {
model(params) {
console.log('Looking for ' + params.verse_id);
return this.store.findRecord('verse', params.verse_id, {
include: 'words'
});

7
app/routes/verse/word.js Normal file
View File

@ -0,0 +1,7 @@
import Route from '@ember/routing/route';
export default class VerseWordRoute extends Route {
model(params) {
return this.store.findRecord('lexical-entry', params.word_id);
}
}

View File

@ -12,7 +12,7 @@ export default class WordSelectService extends Service {
select(word) {
this.currentWord = word;
this.strongsNumber = word.strongsNumber;
this.getLexicalEntry();
// this.getLexicalEntry();
}
async getLexicalEntry() {

View File

@ -13,7 +13,7 @@
<Words::WordTable @model={{model.words}} />
</div>
<div class="col-6">
<Lexicon::Entry />
{{outlet}}
</div>
</div>
</div>

View File

@ -0,0 +1 @@
<Lexicon::Entry @model={{model}}/>

View File

@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | verse/word', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:verse/word');
assert.ok(route);
});
});