aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-05-03 20:53:53 -0700
committerAlex Yatskov <alex@foosoft.net>2016-05-03 20:53:53 -0700
commitf535683e9b35aabe0c481bf5e4b040dc40d019e7 (patch)
treeeb512db85b71ae5c596bb8be35083c268df7f540
parent5eea27004c332dc1fc9ab6b583b5a21b4408b6b2 (diff)
WIP
-rw-r--r--ext/bg/js/templates.js60
-rw-r--r--util/tmpl/kanji-list.html2
-rw-r--r--util/tmpl/kanji.html8
3 files changed, 46 insertions, 24 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index 6ac80841..e47364d1 100644
--- a/ext/bg/js/templates.js
+++ b/ext/bg/js/templates.js
@@ -16,46 +16,60 @@ templates['header.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(c
+ alias4(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"root","hash":{},"data":data}) : helper)))
+ "/css/frame.css\">\n </head>\n <body>\n";
},"useData":true});
-templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) {
+templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
+ var stack1;
+
+ return " "
+ + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.kanji : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + "\n";
+},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
+ return "<a href=\"#\" title=\"Add Kanji\"><img src=\""
+ + container.escapeExpression(container.lambda((depths[1] != null ? depths[1].root : depths[1]), depth0))
+ + "/img/icon_add_expression.png\"></a>";
+},"4":function(container,depth0,helpers,partials,data) {
var stack1;
return " <dt>Meanings</dt>\n <dd>\n"
- + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </dd>\n";
-},"2":function(container,depth0,helpers,partials,data) {
+},"5":function(container,depth0,helpers,partials,data) {
var stack1;
return " "
+ container.escapeExpression(container.lambda(depth0, depth0))
- + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.last),{"name":"unless","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.last),{"name":"unless","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n";
-},"3":function(container,depth0,helpers,partials,data) {
+},"6":function(container,depth0,helpers,partials,data) {
return ", ";
-},"5":function(container,depth0,helpers,partials,data) {
+},"8":function(container,depth0,helpers,partials,data) {
var stack1;
return " <dt>Kunyomi</dt>\n <dd>\n"
- + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </dd>\n";
-},"7":function(container,depth0,helpers,partials,data) {
+},"10":function(container,depth0,helpers,partials,data) {
var stack1;
return " <dt>Onyomi</dt>\n <dd>\n"
- + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </dd>\n";
-},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
- var stack1, helper, alias1=depth0 != null ? depth0 : {};
+},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
+ var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
- return "<div class=\"kanji-definition\">\n <div class=\"kanji-glyph\">"
- + container.escapeExpression(((helper = (helper = helpers.character || (depth0 != null ? depth0.character : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"character","hash":{},"data":data}) : helper)))
- + "</div>\n <div class=\"kanji-info\">\n <dl>\n"
- + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ return "<div class=\"kanji-definition\">\n <div class=\"action-icons\">\n"
+ + ((stack1 = helpers["with"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"with","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " <a href=\"#\" title=\"Copy definition\"><img src=\""
+ + alias4(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"root","hash":{},"data":data}) : helper)))
+ + "/img/icon_copy_definition.png\"></a>\n </div>\n\n <div class=\"kanji-glyph\">"
+ + alias4(((helper = (helper = helpers.character || (depth0 != null ? depth0.character : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"character","hash":{},"data":data}) : helper)))
+ + "</div>\n\n <div class=\"kanji-info\">\n <dl>\n"
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n"
- + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n"
- + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </dl>\n </div>\n</div>\n</div>\n";
-},"useData":true});
+},"useData":true,"useDepths":true});
templates['kanji-link.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var helper;
@@ -63,17 +77,17 @@ templates['kanji-link.html'] = template({"compiler":[7,">= 4.0.0"],"main":functi
+ container.escapeExpression(((helper = (helper = helpers.kanji || (depth0 != null ? depth0.kanji : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"kanji","hash":{},"data":data}) : helper)))
+ "</a>\n";
},"useData":true});
-templates['kanji-list.html'] = template({"1":function(container,depth0,helpers,partials,data) {
+templates['kanji-list.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1;
- return ((stack1 = container.invokePartial(partials["kanji.html"],depth0,{"name":"kanji.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
-},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
+ return ((stack1 = container.invokePartial(partials["kanji.html"],depth0,{"name":"kanji.html","hash":{"root":(depths[1] != null ? depths[1].root : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
+},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
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 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.defs : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"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});
+},"usePartial":true,"useData":true,"useDepths":true});
templates['term.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1, alias1=depth0 != null ? depth0 : {};
diff --git a/util/tmpl/kanji-list.html b/util/tmpl/kanji-list.html
index 542a5e2f..23e4d13f 100644
--- a/util/tmpl/kanji-list.html
+++ b/util/tmpl/kanji-list.html
@@ -1,5 +1,5 @@
{{> header.html}}
{{#each defs}}
-{{> kanji.html}}
+{{> kanji.html root=../root}}
{{/each}}
{{> footer.html}}
diff --git a/util/tmpl/kanji.html b/util/tmpl/kanji.html
index c1883b19..e74fb5ae 100644
--- a/util/tmpl/kanji.html
+++ b/util/tmpl/kanji.html
@@ -1,5 +1,13 @@
<div class="kanji-definition">
+ <div class="action-icons">
+ {{#with addable}}
+ {{#if kanji}}<a href="#" title="Add Kanji"><img src="{{../root}}/img/icon_add_expression.png"></a>{{/if}}
+ {{/with}}
+ <a href="#" title="Copy definition"><img src="{{root}}/img/icon_copy_definition.png"></a>
+ </div>
+
<div class="kanji-glyph">{{character}}</div>
+
<div class="kanji-info">
<dl>
{{#if glossary}}