From 67ca7adc4cabb79a87b51ebd9b112e641de31af9 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 8 Jan 2017 18:39:59 -0800 Subject: [PATCH] WIP --- ext/bg/js/templates.js | 133 ++++++++++++++++-------------------- ext/fg/css/frame.css | 4 +- tmpl/term-definition.html | 16 +++++ tmpl/term-grouped-list.html | 1 + tmpl/term-grouped.html | 19 +----- tmpl/term-list.html | 1 + tmpl/term.html | 18 +---- 7 files changed, 83 insertions(+), 109 deletions(-) create mode 100644 tmpl/term-definition.html diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 88af693d..871c5332 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -128,6 +128,44 @@ templates['model.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.markers : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " \n \n \n \n\n"; },"useData":true}); +templates['term-definition.html'] = template({"1":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
\n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
\n"; +},"2":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return " " + + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) + + "\n"; +},"4":function(container,depth0,helpers,partials,data) { + var stack1; + + return "\n"; +},"5":function(container,depth0,helpers,partials,data) { + return "
  • " + + container.escapeExpression(container.lambda(depth0, depth0)) + + "
  • \n"; +},"7":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
    " + + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + + "
    \n"; +},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var stack1, alias1=depth0 != null ? depth0 : {}; + + return ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : ""); +},"useData":true}); templates['term-grouped.html'] = template({"1":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; @@ -179,44 +217,11 @@ templates['term-grouped.html'] = template({"1":function(container,depth0,helpers },"12":function(container,depth0,helpers,partials,data) { return "«"; },"14":function(container,depth0,helpers,partials,data) { - var stack1, alias1=depth0 != null ? depth0 : {}; - - return "
  • \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.program(21, data, 0),"data":data})) != null ? stack1 : "") - + "
  • \n"; -},"15":function(container,depth0,helpers,partials,data) { var stack1; - return "
    \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n"; -},"16":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return " " - + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) - + "\n"; -},"18":function(container,depth0,helpers,partials,data) { - var stack1; - - return " \n"; -},"19":function(container,depth0,helpers,partials,data) { - return "
  • " - + container.escapeExpression(container.lambda(depth0, depth0)) - + "
  • \n"; -},"21":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
    " - + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) - + "
    \n"; + return "
  • " + + ((stack1 = container.invokePartial(partials["term-definition.html"],depth0,{"name":"term-definition.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
  • \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : {}; @@ -230,7 +235,7 @@ templates['term-grouped.html'] = template({"1":function(container,depth0,helpers + "\n
    \n
      \n" + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(14, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n
    \n\n"; -},"useData":true}); +},"usePartial":true,"useData":true}); templates['term-grouped-list.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; @@ -238,7 +243,8 @@ templates['term-grouped-list.html'] = template({"1":function(container,depth0,he },"2":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = container.invokePartial(partials["term-grouped.html"],depth0,{"name":"term-grouped.html","hash":{"playback":(depths[1] != null ? depths[1].playback : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); + return ((stack1 = container.invokePartial(partials["term-grouped.html"],depth0,{"name":"term-grouped.html","hash":{"playback":(depths[1] != null ? depths[1].playback : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    \n"; },"4":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { @@ -283,39 +289,19 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial },"10":function(container,depth0,helpers,partials,data) { var stack1; + return "
    \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reasons : depth0),{"name":"each","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; +},"11":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(11, 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(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; -},"11":function(container,depth0,helpers,partials,data) { +},"12":function(container,depth0,helpers,partials,data) { return "«"; -},"13":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return " " - + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) - + "\n"; -},"15":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
      \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n"; -},"16":function(container,depth0,helpers,partials,data) { - return "
  • " - + container.escapeExpression(container.lambda(depth0, depth0)) - + "
  • \n"; -},"18":function(container,depth0,helpers,partials,data) { - var stack1; - - return "

    " - + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) - + "

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : {}; @@ -324,14 +310,12 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.playback : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " \n\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.reading : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(8, data, 0),"data":data})) != null ? stack1 : "") - + "\n
    \n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.reasons : depth0),{"name":"each","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n\n
    \n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n\n
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.program(18, data, 0),"data":data})) != null ? stack1 : "") + + "\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.reasons : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n
    \n" + + ((stack1 = container.invokePartial(partials["term-definition.html"],depth0,{"name":"term-definition.html","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + "
    \n
    \n"; -},"useData":true}); +},"usePartial":true,"useData":true}); templates['term-list.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; @@ -339,7 +323,8 @@ templates['term-list.html'] = template({"1":function(container,depth0,helpers,pa },"2":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","hash":{"playback":(depths[1] != null ? depths[1].playback : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); + return ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","hash":{"playback":(depths[1] != null ? depths[1].playback : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    \n"; },"4":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { diff --git a/ext/fg/css/frame.css b/ext/fg/css/frame.css index f07358aa..bb3596dc 100644 --- a/ext/fg/css/frame.css +++ b/ext/fg/css/frame.css @@ -138,8 +138,8 @@ body { } .term-glossary-group { - padding-bottom: 0.7em; - padding-top: 0.7em; + margin-top: 0.4em; + margin-bottom: 0.4em; } .term-glossary-item { diff --git a/tmpl/term-definition.html b/tmpl/term-definition.html new file mode 100644 index 00000000..03356a59 --- /dev/null +++ b/tmpl/term-definition.html @@ -0,0 +1,16 @@ +{{#if tags}} +
    + {{#each tags}} + {{name}} + {{/each}} +
    +{{/if}} +{{#if glossary.[1]}} + +{{else}} +
    {{glossary.[0]}}
    +{{/if}} diff --git a/tmpl/term-grouped-list.html b/tmpl/term-grouped-list.html index 6156ab7b..d927abc4 100644 --- a/tmpl/term-grouped-list.html +++ b/tmpl/term-grouped-list.html @@ -1,6 +1,7 @@ {{#if definitions}} {{#each definitions}} {{> term-grouped.html addable=../addable playback=../playback}} +
    {{/each}} {{else}}

    No results found

    diff --git a/tmpl/term-grouped.html b/tmpl/term-grouped.html index ac15a126..0de22bb9 100644 --- a/tmpl/term-grouped.html +++ b/tmpl/term-grouped.html @@ -26,24 +26,7 @@
      {{#each definitions}} -
    1. - {{#if tags}} -
      - {{#each tags}} - {{name}} - {{/each}} -
      - {{/if}} - {{#if glossary.[1]}} -
        - {{#each glossary}} -
      • {{.}}
      • - {{/each}} -
      - {{else}} -
      {{glossary.[0]}}
      - {{/if}} -
    2. +
    3. {{> term-definition.html}}
    4. {{/each}}
    diff --git a/tmpl/term-list.html b/tmpl/term-list.html index b4c9d997..ab03c7c2 100644 --- a/tmpl/term-list.html +++ b/tmpl/term-list.html @@ -1,6 +1,7 @@ {{#if definitions}} {{#each definitions}} {{> term.html addable=../addable playback=../playback}} +
    {{/each}} {{else}}

    No results found

    diff --git a/tmpl/term.html b/tmpl/term.html index a6ae2d26..59ac80df 100644 --- a/tmpl/term.html +++ b/tmpl/term.html @@ -15,27 +15,15 @@
    {{#kanjiLinks}}{{expression}}{{/kanjiLinks}}
    {{/if}} + {{#if reasons}}
    {{#each reasons}} {{.}} {{#unless @last}}«{{/unless}} {{/each}}
    - -
    - {{#each tags}} - {{name}} - {{/each}} -
    + {{/if}}
    - {{#if glossary.[1]}} -
      - {{#each glossary}} -
    1. {{.}}
    2. - {{/each}} -
    - {{else}} -

    {{glossary.[0]}}

    - {{/if}} + {{> term-definition.html}}