From 6f45cc287112030387f33169c762ee9448c0c65c Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 17 Apr 2016 18:20:39 -0700 Subject: [PATCH] Splitting out header and footer templates --- ext/bg/js/templates.js | 38 ++++++++++++++--------- util/tmpl/defs.html => ext/fg/footer.html | 0 ext/fg/header.html | 21 +++++++++++++ ext/fg/js/client.js | 2 +- util/tmpl/footer.html | 3 ++ util/tmpl/header.html | 11 +++++++ util/tmpl/term-list.html | 7 +++++ 7 files changed, 67 insertions(+), 15 deletions(-) rename util/tmpl/defs.html => ext/fg/footer.html (100%) create mode 100644 ext/fg/header.html create mode 100644 util/tmpl/footer.html create mode 100644 util/tmpl/header.html create mode 100644 util/tmpl/term-list.html diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 46a4001f..c278a574 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -1,22 +1,19 @@ (function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['defs.html'] = template({"1":function(container,depth0,helpers,partials,data) { - var stack1; +templates['footer.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var helper; - return "
\n" - + ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
\n"; -},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { - var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + return " \n \n\n"; +},"useData":true}); +templates['header.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var helper; return "\n\n \n \n \n \n \n \n
\n \n
\n\n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.defs : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n \n \n\n"; -},"usePartial":true,"useData":true}); + + container.escapeExpression(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"root","hash":{},"data":data}) : helper))) + + "/css/popup.css\">\n \n \n
\n \n
\n"; +},"useData":true}); templates['term.html'] = template({"1":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; @@ -73,4 +70,17 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " \n\n"; },"useData":true}); +templates['term-list.html'] = template({"1":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
\n" + + ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
\n"; +},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = container.invokePartial(partials["header.html"],depth0,{"name":"header.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.defs : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = container.invokePartial(partials["footer.html"],depth0,{"name":"footer.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); +},"usePartial":true,"useData":true}); })(); \ No newline at end of file diff --git a/util/tmpl/defs.html b/ext/fg/footer.html similarity index 100% rename from util/tmpl/defs.html rename to ext/fg/footer.html diff --git a/ext/fg/header.html b/ext/fg/header.html new file mode 100644 index 00000000..3f37d8bd --- /dev/null +++ b/ext/fg/header.html @@ -0,0 +1,21 @@ + + + + + + + + +
+ +
+ + {{#each defs}} +
+ {{> term.html}} +
+ {{/each}} + + + + diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js index 4df19594..aae051fa 100644 --- a/ext/fg/js/client.js +++ b/ext/fg/js/client.js @@ -119,7 +119,7 @@ class Client { this.hidePopup(); } else { const params = {defs: results, root: chrome.extension.getURL('fg'), activeDict: this.activeDict}; - renderText(params, 'defs.html', (html) => this.showPopup(range, html, popupQuery, length)); + renderText(params, 'term-list.html', (html) => this.showPopup(range, html, popupQuery, length)); } }); } diff --git a/util/tmpl/footer.html b/util/tmpl/footer.html new file mode 100644 index 00000000..7c2cac6b --- /dev/null +++ b/util/tmpl/footer.html @@ -0,0 +1,3 @@ + + + diff --git a/util/tmpl/header.html b/util/tmpl/header.html new file mode 100644 index 00000000..b7577dd5 --- /dev/null +++ b/util/tmpl/header.html @@ -0,0 +1,11 @@ + + + + + + + + +
+ +
diff --git a/util/tmpl/term-list.html b/util/tmpl/term-list.html new file mode 100644 index 00000000..9e55a80e --- /dev/null +++ b/util/tmpl/term-list.html @@ -0,0 +1,7 @@ +{{> header.html}} +{{#each defs}} +
+ {{> term.html}} +
+{{/each}} +{{> footer.html}}