X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=5b428bf9994ea47be1ece31b26920aa83b1ced14;hb=72e0d26475c1cee0ef58f8a0e31b01cd1b58940a;hp=0638ee47084f6edb9b4e41128f8cd83847f3ced3;hpb=17c48ded3548965541ccf15cbb90da1788368e34;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 0638ee4..5b428bf 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -714,10 +714,7 @@ function maybeLoadTemplate(name) { var source = $("#mkwsTemplate" + name).html(); if (!source) { - debug("no template '" + name + "': falling back to default behaviour"); - // Mark template as not provided - mkws['template' + name] = 0; - return; + source = defaultTemplate(name); } var template = Handlebars.compile(source); @@ -726,6 +723,74 @@ function maybeLoadTemplate(name) } +function defaultTemplate(name) +{ + if (name === 'Record') { + return '\ + \ + \ + \ + \ + \ + {{#if md-date}}\ + \ + \ + \ + \ + {{/if}}\ + {{#if md-author}}\ + \ + \ + \ + \ + {{/if}}\ + {{#if md-electronic-url}}\ + \ + \ + \ + \ + {{/if}}\ + {{#if-any location having="md-subject"}}\ + \ + \ + \ + \ + {{/if-any}}\ + \ + \ + \ + \ +
Title\ + {{md-title}}\ + {{#if md-title-remainder}}\ + ({{md-title-remainder}})\ + {{/if}}\ + {{#if md-title-responsibility}}\ + {{md-title-responsibility}}\ + {{/if}}\ +
Date{{md-date}}
Author{{md-author}}
URL\ + {{#each md-electronic-url}}\ + {{this}}
\ + {{/each}}\ +
Subject\ + {{#first location having="md-subject"}}\ + {{#if md-subject}}\ + {{md-subject}}\ + {{/if}}\ + {{/first}}\ +
Locations\ + {{#commaList location}}\ + {{attr "@name"}}{{/commaList}}\ +
\ +'; + } + + var s = "There is no default '" + name +"' template!"; + alert(s); + return s; +} + + function defaultRenderDetails(data, marker) { var details = '';