From c81643e172cc00b4fb697a4c5209a62687e98cf0 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 5 Mar 2014 09:33:38 +0000 Subject: [PATCH] Move mkws.defaultTemplate() out of the team structure. Fixes part of MKWS-126. --- tools/htdocs/mkws.js | 164 +++++++++++++++++++++++++------------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 3a44f46..78f1e46 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1078,7 +1078,7 @@ function team($, teamName) { var source = node.html(); if (!source) { - source = defaultTemplate(name); + source = mkws.defaultTemplate(name); } template = Handlebars.compile(source); @@ -1090,87 +1090,6 @@ function team($, teamName) { } - 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}}\ - \ - \ - \ - \ -
{{translate "Title"}}\ - {{md-title}}\ - {{#if md-title-remainder}}\ - ({{md-title-remainder}})\ - {{/if}}\ - {{#if md-title-responsibility}}\ - {{md-title-responsibility}}\ - {{/if}}\ -
{{translate "Date"}}{{md-date}}
{{translate "Author"}}{{md-author}}
{{translate "Links"}}\ - {{#each md-electronic-url}}\ - Link{{index1}}\ - {{/each}}\ -
{{translate "Subject"}}\ - {{#first location having="md-subject"}}\ - {{#if md-subject}}\ - {{#commaList md-subject}}\ - {{this}}{{/commaList}}\ - {{/if}}\ - {{/first}}\ -
{{translate "Locations"}}\ - {{#commaList location}}\ - {{attr "@name"}}{{/commaList}}\ -
\ -'; - } else if (name === "Summary") { - return '\ -\ - {{md-title}}\ -\ -{{#if md-title-remainder}}\ - {{md-title-remainder}}\ -{{/if}}\ -{{#if md-title-responsibility}}\ - {{md-title-responsibility}}\ -{{/if}}\ -'; - } - - var s = "There is no default '" + name +"' template!"; - alert(s); - return s; - } - - // The following PubSub code is modified from the jQuery manual: // https://api.jquery.com/jQuery.Callbacks/ // @@ -1328,6 +1247,87 @@ function team($, teamName) { } + mkws.defaultTemplate = function(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}}\ + \ + \ + \ + \ +
{{translate "Title"}}\ + {{md-title}}\ + {{#if md-title-remainder}}\ + ({{md-title-remainder}})\ + {{/if}}\ + {{#if md-title-responsibility}}\ + {{md-title-responsibility}}\ + {{/if}}\ +
{{translate "Date"}}{{md-date}}
{{translate "Author"}}{{md-author}}
{{translate "Links"}}\ + {{#each md-electronic-url}}\ + Link{{index1}}\ + {{/each}}\ +
{{translate "Subject"}}\ + {{#first location having="md-subject"}}\ + {{#if md-subject}}\ + {{#commaList md-subject}}\ + {{this}}{{/commaList}}\ + {{/if}}\ + {{/first}}\ +
{{translate "Locations"}}\ + {{#commaList location}}\ + {{attr "@name"}}{{/commaList}}\ +
\ +'; + } else if (name === "Summary") { + return '\ +\ + {{md-title}}\ +\ +{{#if md-title-remainder}}\ + {{md-title-remainder}}\ +{{/if}}\ +{{#if md-title-responsibility}}\ + {{md-title-responsibility}}\ +{{/if}}\ +'; + } + + var s = "There is no default '" + name +"' template!"; + alert(s); + return s; + } + + function defaultMkwsConfig() { /* default mkws config */ var config_default = { -- 1.7.10.4