From a44612f84f87a788c66a35b361deb62e6bc04c1c Mon Sep 17 00:00:00 2001 From: Jason Skomorowski Date: Fri, 24 Oct 2014 18:19:10 -0400 Subject: [PATCH] Split summary out of records template MKWS-312 --- src/mkws-widget-main.js | 5 +++-- src/templates/records.handlebars | 15 ++------------- src/templates/summary.handlebars | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 src/templates/summary.handlebars diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js index 0ee99f3..ac43dcd 100644 --- a/src/mkws-widget-main.js +++ b/src/mkws-widget-main.js @@ -130,8 +130,9 @@ mkws.registerWidgetType('records', function() { } } var template = team.loadTemplate(that.config.template || "records"); - var targs = $.extend({}, {"hits": data.hits}, that.config.template_vars); - that.node.html(template(targs)); + var summaryPartial = team.loadTemplate("summary"); + var tdata = $.extend({}, {"hits": data.hits}, that.config.template_vars); + that.node.html(template(tdata, {"partials":{"summary":summaryPartial}})); }); that.autosearch(); diff --git a/src/templates/records.handlebars b/src/templates/records.handlebars index 3e1b3a7..07e6801 100644 --- a/src/templates/records.handlebars +++ b/src/templates/records.handlebars @@ -8,22 +8,11 @@ hits: containerClass - partial class attribute for element containing a record detailLinkId - id for the element triggering detail display detailClick - a click event handler for details - renderedDetails - active record details rendered from the Record template + renderedDetails - active record details rendered from the details template md-* - metadata fields passed through from backend }} {{#each hits}}
- - {{md-title}} - - {{#if md-title-remainder}} - {{md-title-remainder}} - {{/if}} - {{#if md-title-responsibility}} - {{md-title-responsibility}} - {{/if}} - {{#if renderedDetails}} - {{{renderedDetails}}} - {{/if}} + {{>summary}}
{{/each}} diff --git a/src/templates/summary.handlebars b/src/templates/summary.handlebars new file mode 100644 index 0000000..aa2ed10 --- /dev/null +++ b/src/templates/summary.handlebars @@ -0,0 +1,24 @@ +{{! +Brief record from a search. + +The non-metadata keys enable an optional link to display an AJAX popup that +fetches additional record detail. + +containerClass - partial class attribute for element containing a record +detailLinkId - id for the element triggering detail display +detailClick - a click event handler for details +renderedDetails - active record details rendered from the details template +md-* - metadata fields passed through from backend +}} + + {{md-title}} + +{{#if md-title-remainder}} + {{md-title-remainder}} +{{/if}} +{{#if md-title-responsibility}} + {{md-title-responsibility}} +{{/if}} +{{#if renderedDetails}} + {{{renderedDetails}}} +{{/if}} -- 1.7.10.4