aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-11-06 17:10:31 -0800
committerAlex Yatskov <alex@foosoft.net>2016-11-06 17:10:31 -0800
commitfd6622400f64b2d568d38bde72f9fd75f8d06beb (patch)
tree35c7772acc0b37e56196138207bf4e73a5061d5d /ext/bg/js/options-form.js
parent5172155c7813965ca8f896940fa30e613f08ebac (diff)
Templates
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js36
1 files changed, 17 insertions, 19 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 060ee269..ec603eed 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -155,25 +155,21 @@ function populateAnkiDeckAndModel(opts) {
}
function populateDictionaries() {
- // const dictGroups = $('.dictionaries');
- // dictGroups.empty();
-
- // yomichan().translator.dictionary.getNames().then(rows => {
- // for (const row of rows) {
- // const dictPanel = $('<div>', {class: 'dictionary panel panel-default'});
- // const dictRow = $('<div>', {class: 'panel-body row'}).appendTo(dictPanel);
-
- // const title = $('<div>', {class: 'col-xs-8'});
- // $('<h4>').append().html(`<span class="text-muted glyphicon glyphicon-book"></span> ${row.dictionary} <small>v.${row.version}</small>`).appendTo(title);
- // title.appendTo(dictRow);
-
- // const controls = $('<div>', {class: 'col-xs-4 text-right'});
- // $('<button>', {class: 'btn btn-danger dictionary-delete'}).text('Delete').appendTo(controls);
- // controls.appendTo(dictRow);
-
- // dictGroups.append(dictPanel);
- // }
- // });
+ const dictGroups = $('.dictionaries');
+ dictGroups.empty();
+
+ yomichan().translator.dictionary.getInfo().then(rows => {
+ for (const row of rows) {
+ const html = Handlebars.templates['dictionary.html']({
+ name: row.dictionary,
+ version: row.version,
+ hasTerms: row.hasTerms,
+ hasKanji: row.hasKanji
+ });
+
+ dictGroups.append($(html));
+ }
+ });
}
function populateAnkiFields(element, opts) {
@@ -276,6 +272,8 @@ function onAnkiModelChanged(e) {
}
$(document).ready(() => {
+ Handlebars.partials = Handlebars.templates;
+
loadOptions().then(opts => {
$('#activate-on-startup').prop('checked', opts.activateOnStartup);
$('#enable-audio-playback').prop('checked', opts.enableAudioPlayback);