From b81e11f633ab9a0f41b5ab28b032b8493f25150a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 23 Dec 2016 21:59:19 -0800 Subject: revision support --- ext/bg/js/database.js | 6 ++-- ext/bg/js/options-form.js | 1 + ext/bg/js/templates.js | 86 +++++++++++++++++++++++------------------------ ext/bg/js/util.js | 5 +-- 4 files changed, 50 insertions(+), 48 deletions(-) (limited to 'ext/bg/js') diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 7ad7d410..a21708f5 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -224,14 +224,14 @@ class Database { } let summary = null; - const indexLoaded = (title, version, tagMeta, hasTerms, hasKanji) => { - summary = {title, hasTerms, hasKanji, version}; + const indexLoaded = (title, version, revision, tagMeta, hasTerms, hasKanji) => { + summary = {title, version, revision, hasTerms, hasKanji}; return this.db.dictionaries.where('title').equals(title).count().then(count => { if (count > 0) { return Promise.reject(`dictionary "${title}" is already imported`); } - return this.db.dictionaries.add({title, version, hasTerms, hasKanji}).then(() => { + return this.db.dictionaries.add({title, version, revision, hasTerms, hasKanji}).then(() => { const rows = []; for (const tag in tagMeta || {}) { const meta = tagMeta[tag]; diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js index a999bd22..ae13dbb1 100644 --- a/ext/bg/js/options-form.js +++ b/ext/bg/js/options-form.js @@ -161,6 +161,7 @@ function populateDictionaries(opts) { const html = Handlebars.templates['dictionary.html']({ title: row.title, version: row.version, + revision: row.revision, hasTerms: row.hasTerms, hasKanji: row.hasKanji, enableTerms: dictOpts.enableTerms, diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 1480bb17..f6ff8467 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -11,8 +11,8 @@ templates['dictionary.html'] = template({"1":function(container,depth0,helpers,p + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) + "\">\n

" + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) - + " v." - + alias4(((helper = (helper = helpers.version || (depth0 != null ? depth0.version : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"version","hash":{},"data":data}) : helper))) + + " rev." + + alias4(((helper = (helper = helpers.revision || (depth0 != null ? depth0.revision : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"revision","hash":{},"data":data}) : helper))) + "

\n\n \n \n