Rename all the templates MKWS-313
authorJason Skomorowski <jason@indexdata.com>
Thu, 23 Oct 2014 14:27:39 +0000 (10:27 -0400)
committerJason Skomorowski <jason@indexdata.com>
Thu, 23 Oct 2014 14:27:39 +0000 (10:27 -0400)
39 files changed:
src/mkws-team.js
src/mkws-widget-main.js
src/mkws-widget-record.js
src/mkws-widget-reference.js
src/mkws-widget-termlists.js
src/templates/Done.handlebars [deleted file]
src/templates/Facet.handlebars [deleted file]
src/templates/Image.handlebars [deleted file]
src/templates/Lang.handlebars [deleted file]
src/templates/Navi.handlebars [deleted file]
src/templates/Pager.handlebars [deleted file]
src/templates/Progress.handlebars [deleted file]
src/templates/Ranking.handlebars [deleted file]
src/templates/Record.handlebars [deleted file]
src/templates/Records.handlebars [deleted file]
src/templates/Reference.handlebars [deleted file]
src/templates/Results.handlebars [deleted file]
src/templates/Search.handlebars [deleted file]
src/templates/Stat.handlebars [deleted file]
src/templates/Switch.handlebars [deleted file]
src/templates/Targets.handlebars [deleted file]
src/templates/Termlists.handlebars [deleted file]
src/templates/details.handlebars [new file with mode: 0644]
src/templates/done.handlebars [new file with mode: 0644]
src/templates/facet.handlebars [new file with mode: 0644]
src/templates/image.handlebars [new file with mode: 0644]
src/templates/lang.handlebars [new file with mode: 0644]
src/templates/navi.handlebars [new file with mode: 0644]
src/templates/pager.handlebars [new file with mode: 0644]
src/templates/progress.handlebars [new file with mode: 0644]
src/templates/ranking.handlebars [new file with mode: 0644]
src/templates/records.handlebars [new file with mode: 0644]
src/templates/reference.handlebars [new file with mode: 0644]
src/templates/results.handlebars [new file with mode: 0644]
src/templates/search.handlebars [new file with mode: 0644]
src/templates/stat.handlebars [new file with mode: 0644]
src/templates/switch.handlebars [new file with mode: 0644]
src/templates/targets.handlebars [new file with mode: 0644]
src/templates/termlists.handlebars [new file with mode: 0644]

index 509fc2f..3ac9e72 100644 (file)
@@ -408,7 +408,7 @@ mkws.makeTeam = function($, teamName) {
   }
 
   function renderDetails(data, marker) {
-    var template = loadTemplate("Record");
+    var template = loadTemplate("details");
     var details = template(data);
     return '<div class="mkws-details mkwsDetails mkwsTeam_' + m_teamName + '" ' +
       'id="' + recordDetailsId(data.recid[0]) + '">' + details + '</div>';
index 3ee3bc7..0ee99f3 100644 (file)
@@ -27,7 +27,7 @@ mkws.registerWidgetType('targets', function() {
       cleandata.push(cur);
     }
 
-    var template = that.team.loadTemplate(that.config.template || "Targets");
+    var template = that.team.loadTemplate(that.config.template || "targets");
     that.node.html(template({data: cleandata}));
   });
 });
@@ -36,7 +36,7 @@ mkws.registerWidgetType('targets', function() {
 mkws.registerWidgetType('stat', function() {
   var that = this;
   this.team.queue("stat").subscribe(function(data) {
-    var template = that.team.loadTemplate(that.config.template || "Stat");
+    var template = that.team.loadTemplate(that.config.template || "stat");
     that.node.html(template(data));
   });
 });
@@ -83,7 +83,7 @@ mkws.registerWidgetType('pager', function() {
 
     if (pages - currentPage > 0) output.nextClick = "mkws.pagerNext(\'" + teamName + "\')";
 
-    var template = that.team.loadTemplate(that.config.template || "Pager");
+    var template = that.team.loadTemplate(that.config.template || "pager");
     that.node.html(template(output));
   });
 });
@@ -101,7 +101,7 @@ mkws.registerWidgetType('details', function() {
   this.team.queue("record").subscribe(function(data) {
     console.log(data);
     if ($.inArray(recid, data.recid) > -1) {
-      var template = that.team.loadTemplate(that.config.template || "Record");
+      var template = that.team.loadTemplate(that.config.template || "details");
       that.node.html(template(data));
     }
   });
@@ -129,7 +129,7 @@ mkws.registerWidgetType('records', function() {
         } 
       }
     }
-    var template = team.loadTemplate(that.config.template || "Records");
+    var template = team.loadTemplate(that.config.template || "records");
     var targs = $.extend({}, {"hits": data.hits}, that.config.template_vars);
     that.node.html(template(targs));
   });
@@ -162,7 +162,7 @@ mkws.registerWidgetType('navi', function() {
       output.filters.push(cur);
     });
 
-    var template = that.team.loadTemplate(that.config.template || "Navi");
+    var template = that.team.loadTemplate(that.config.template || "navi");
     that.node.html(template(output));
   });
 });
@@ -200,7 +200,7 @@ mkws.registerWidgetType('per-page', function() {
 mkws.registerWidgetType('done', function() {
   var that = this;
   this.team.queue("complete").subscribe(function(n) {
-    var template = that.team.loadTemplate(that.config.template || "Done");
+    var template = that.team.loadTemplate(that.config.template || "done");
     that.node.html(template({count: n}));
   });
 });
@@ -212,7 +212,7 @@ mkws.registerWidgetType('switch', function() {
   var output = {};
   output.recordClick = "mkws.switchView(\'" + tname + "\', \'records\')";
   output.targetClick = "mkws.switchView(\'" + tname + "\', \'targets\')";
-  var template = this.team.loadTemplate(this.config.template || "Switch");
+  var template = this.team.loadTemplate(this.config.template || "switch");
   this.node.html(template(output));
   this.hideWhenNarrow();
 });
@@ -222,7 +222,7 @@ mkws.registerWidgetType('search', function() {
   var output = {};
   output.team = this.team.name();
   output.queryWidth = this.config.query_width;
-  var template = this.team.loadTemplate(this.config.template || "Search");
+  var template = this.team.loadTemplate(this.config.template || "search");
   this.node.html(template(output));
 });
 
@@ -238,7 +238,7 @@ mkws.registerWidgetType('search-form', function() {
 
 
 mkws.registerWidgetType('results', function() {
-  var template = this.team.loadTemplate(this.config.template || "Results");
+  var template = this.team.loadTemplate(this.config.template || "results");
   this.node.html(template({team: this.team.name()}));
   this.autosearch();
 });
@@ -272,7 +272,7 @@ mkws.registerWidgetType('ranking', function() {
     output.perPage.push(cur);
   }
 
-  var template = this.team.loadTemplate(this.config.template || "Ranking");
+  var template = this.team.loadTemplate(this.config.template || "ranking");
   this.node.html(template(output));
 });
 
@@ -314,7 +314,7 @@ mkws.registerWidgetType('lang', function() {
 
   this.log("language menu: " + list.join(", "));
 
-  var template = this.team.loadTemplate(this.config.template || "Lang");
+  var template = this.team.loadTemplate(this.config.template || "lang");
   this.node.html(template({languages: list}));
   this.hideWhenNarrow();
 
@@ -367,7 +367,7 @@ mkws.registerWidgetType('progress', function() {
   var that = this;
   this.node.hide();
   this.team.queue("stat").subscribe(function(data) {
-    var template = that.team.loadTemplate(that.config.template || "Progress");
+    var template = that.team.loadTemplate(that.config.template || "progress");
     that.node.html(template({
       done: data.clients - data.activeclients,
       waiting: data.activeclients
index 1d77e40..ba3fce2 100644 (file)
@@ -4,7 +4,7 @@ mkws.registerWidgetType('record', function() {
   var that = this;
   var team = this.team;
   team.queue("records").subscribe(function(data) {
-    var template = team.loadTemplate(that.config.template || "Record");
+    var template = team.loadTemplate(that.config.template || "details");
     var targs = mkws.$.extend({}, data.hits[0], that.config.template_vars);
     that.node.html(template(targs));
   });
index 2993a60..85c04b8 100644 (file)
@@ -1,7 +1,7 @@
 mkws.registerWidgetType('reference', function() {
   mkws.promotionFunction('record').call(this);
   if (!this.config.target) this.config.target = 'wikimedia_wikipedia_single_result';
-  if (!this.config.template) this.config.template = 'Reference';
+  if (!this.config.template) this.config.template = 'reference';
   this.config.template_vars.paragraphs = this.config.paragraphs || 0;
   this.config.template_vars.sentences = this.config.sentences || 0;
 });
index e8cab10..e3dc55e 100644 (file)
@@ -6,7 +6,7 @@ mkws.registerWidgetType('termlists', function() {
     that.node.addClass("active");
   });
 
-  var template = team.loadTemplate(this.config.template || "Termlists");
+  var template = team.loadTemplate(this.config.template || "termlists");
   this.node.html(template({
     team: team.name(),
     facets: this.config.facets
@@ -67,7 +67,7 @@ mkws.registerWidgetType('facet', function() {
         that.log("Using facet-" + name + " template.")
       } else {
         that.log("No " + name + " specific template, using default.")
-        template = team.loadTemplate("Facet");
+        template = team.loadTemplate("facet");
       }
     }
     that.node.html(template({
diff --git a/src/templates/Done.handlebars b/src/templates/Done.handlebars
deleted file mode 100644 (file)
index 59a0b4f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-{{!
-Displayed on search completion
-
-count - number of results found
-}}
-{{{mkws-translate "Search complete: found"}}} {{count}} {{{mkws-translate "records"}}}
-
diff --git a/src/templates/Facet.handlebars b/src/templates/Facet.handlebars
deleted file mode 100644 (file)
index 7a4eedf..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-{{!
-A facet in the search.
-
-name - facet identifier, typically English and lowercase
-caption - caption for this facet
-terms:
-  term - term name
-  count - count of items matching in the current search for this team
-  linkdata - attributes to add to the term element including an onclick handler
-  field - for the xtargets facet ONLY, the opaque identifier of the target
-}}
-
-<div class="mkws-facet-title mkwsFacetTitle">{{caption}}</div>
-{{#each terms}}
-  <div class="mkws-term mkwsTerm">
-    <a href="#" {{{linkdata}}}>{{term}}</a> <span>{{count}}</span>
-  </div>
-{{/each}}
diff --git a/src/templates/Image.handlebars b/src/templates/Image.handlebars
deleted file mode 100644 (file)
index f74f174..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-{{!
-Records presented as images.
-
-The non-metadata keys enable an optional link to display an AJAX popup that
-fetches additional record detail.
-
-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
-  md-* - metadata fields passed through from backend
-}}
-{{#each hits}}
-  <a href="#" id="{{detailLinkId}}" onclick="{{detailClick}}">
-    {{#mkws-first md-thumburl}}
-      <img src="{{this}}" alt="{{../md-title}}"/>
-    {{/mkws-first}}
-    <br/>
-  </a>
-{{/each}}
diff --git a/src/templates/Lang.handlebars b/src/templates/Lang.handlebars
deleted file mode 100644 (file)
index 26ee6da..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{{!
-Language selection widget
-
-languages
-  code - two character language identifier
-  selected - exists for the current language
-  url - url to switch to this language
-}}
-{{#each languages}}
-  {{~#if selected~}}
-    <span>{{code}}</span>
-  {{~else~}}
-    <a href="{{{url}}}">{{code}}</a>
-  {{~/if~}}
-  {{#unless last}}
-    |
-  {{/unless}}
-{{/each}}
-
diff --git a/src/templates/Navi.handlebars b/src/templates/Navi.handlebars
deleted file mode 100644 (file)
index 5139fd7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-{{!
-Facet breadcrumbs -- filters on the current search
-
-filters
-  facet - name of facet being limited
-  value - limit to this value
-  click - handler script to remove limit
-}}
-{{#each filters}}
-  {{{mkws-translate facet}}}: <a class="mkws-removable mkwsRemovable" href="#" onclick="{{{click}}}">{{value}}</a>
-  {{#unless @last}}|{{/unless}}
-{{/each}}
-
diff --git a/src/templates/Pager.handlebars b/src/templates/Pager.handlebars
deleted file mode 100644 (file)
index 55768e8..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-{{!
-Pager
-
-nextClick - handler script for "next" button, only available if there is a next page
-prevClick - handler script for "previous" button if there is a previous page
-moreNext - indicates there are more pages following those displayed
-morePrev - indicates there are more pages preceding
-first - first record displayed
-last - last record displayed
-count - number of records available
-found - number of records found
-pages:
-  number - page number
-  click - script to go to this page unless it is the current one
-}}
-<div style="float: right">
-  {{mkws-translate "Displaying"}}:
-  {{first}} {{mkws-translate "to"}} {{last}}
-  {{mkws-translate "of"}} {{count}} ({{{mkws-translate "found"}}}: {{found}})
-</div>
-
-<div style="float: clear">
-  {{#if prevClick}}
-    <a href="#" class="mkws-prev mkwsPrev" onclick="{{prevClick}}">&#60;&#60; {{{mkws-translate "Prev"}}}</a> |
-  {{else}}
-    <span class="mkws-prev mkwsPrev">&#60;&#60; {{{mkws-translate "Prev"}}}</span> |
-  {{/if}}
-
-  {{#if morePrev}}...{{/if}}
-
-  {{#each pages}}
-    {{#if click}}
-      <a href="#" onclick="{{click}}">{{number}}</a>
-    {{else}}
-      <span class="mkws-current-page mkwsCurrentPage">{{number}}</span>
-    {{/if}}
-  {{/each}}
-
-  {{#if moreNext}}...{{/if}}
-
-  {{#if nextClick}}
-    | <a href="#" class="mkws-next mkwsNext" onclick="{{nextClick}}">{{{mkws-translate "Next"}}} &#62;&#62;</a>
-  {{else}}
-    | <span class="mkws-next mkwsNext">{{{mkws-translate "Next"}}} &#62;&#62;</span>
-  {{/if}}
-</div>
diff --git a/src/templates/Progress.handlebars b/src/templates/Progress.handlebars
deleted file mode 100644 (file)
index 603c5ca..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{{!
-Progress
-
-done - number of targets complete
-waiting - number of targets waiting
-}}
-<span class="mkws-done mkws-done mkwsDone">{{#mkws-repeat done}}&#x2588;{{/mkws-repeat}}</span>
-{{~#if waiting~}}
-<span class="mkws-waiting mkws-waiting mkwsWaiting">{{#mkws-repeat waiting}}&#x2588;{{/mkws-repeat}}</span>
-{{~/if~}}
-
diff --git a/src/templates/Ranking.handlebars b/src/templates/Ranking.handlebars
deleted file mode 100644 (file)
index 890e29a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-{{!
-Ranking -- widget to select sort ordering and number of records to display
-
-team - team for this widget
-showSort - set if sort control is to be displayed
-showPerPage - set if per-page control is to be displayed
-sort
-  key - machine readable value for this sort option
-  label - text to display for this sort option
-  selected - exists if this sort is selected
-perPage
-  perPage - a number of records per page that can be selected
-  selected - exists if this number is the current selection
-}}
-<form>
-  {{~#if showSort~}}
-    {{{mkws-translate "Sort by"}}}
-    <select class="mkws-sort mkwsSort mkws-team-{{team}}">
-      {{#each sort}}
-        {{#if selected}}
-          <option value="{{{key}}}" selected="selected">{{{mkws-translate label}}}</option>
-        {{else}}
-          <option value="{{key}}">{{{mkws-translate label}}}</option>
-        {{/if}}
-      {{/each}}  
-    </select>
-  {{~/if~}}
-  {{~#if showPerPage}}
-    {{{mkws-translate "and show"}}}
-    <select class="mkws-perpage mkwsPerpage mkws-team-{{team}}">
-      {{#each perPage}}
-        {{#if selected}}
-          <option value="{{perPage}}" selected="selected">{{perPage}}</option>
-        {{else}}
-          <option value="{{perPage}}">{{perPage}}</option>
-        {{/if}}
-      {{/each}}  
-    </select>
-    {{{mkws-translate "per page"}}}
-  {{~/if~}}
-</form>
-
diff --git a/src/templates/Record.handlebars b/src/templates/Record.handlebars
deleted file mode 100644 (file)
index 9e8184e..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-{{!
-Full record display.
-
-Top level object is metadata from Service Proxy / Pazpar2
-}}
-<table>
-  <tr>
-    <th>{{mkws-translate "Title"}}</th>
-    <td>
-      {{md-title}}
-      {{#if md-title-remainder}}
-        ({{md-title-remainder}})
-      {{/if}}
-      {{#if md-title-responsibility}}
-        <i>{{md-title-responsibility}}</i>
-      {{/if}}
-    </td>
-  </tr>
-  {{#if md-date}}
-  <tr>
-    <th>{{mkws-translate "Date"}}</th>
-    <td>{{md-date}}</td>
-  </tr>
-  {{/if}}
-  {{#if md-author}}
-  <tr>
-    <th>{{mkws-translate "Author"}}</th>
-    <td>{{md-author}}</td>
-  </tr>
-  {{/if}}
-  {{#if md-electronic-url}}
-  <tr>
-    <th>{{mkws-translate "Links"}}</th>
-    <td>
-      {{#each md-electronic-url}}
-        <a href="{{this}}">Link{{mkws-index1}}</a>
-      {{/each}}
-    </td>
-  </tr>
-  {{/if}}
-  {{#mkws-if-any location having="md-subject"}}
-  <tr>
-    <th>{{mkws-translate "Subject"}}</th>
-    <td>
-      {{#mkws-first location having="md-subject"}}
-        {{#if md-subject}}
-          {{#mkws-commaList md-subject}}
-            {{this}}{{/mkws-commaList}}
-        {{/if}}
-      {{/mkws-first}}
-    </td>
-  </tr>
-  {{/mkws-if-any}}
-  <tr>
-    <th>{{mkws-translate "Locations"}}</th>
-    <td>
-      {{#mkws-commaList location}}
-        {{mkws-attr "@name"}}{{/mkws-commaList}}
-    </td>
-  </tr>
-</table>
diff --git a/src/templates/Records.handlebars b/src/templates/Records.handlebars
deleted file mode 100644 (file)
index 3e1b3a7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-{{!
-Records from a search.
-
-The non-metadata keys enable an optional link to display an AJAX popup that
-fetches additional record detail.
-
-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
-  md-* - metadata fields passed through from backend
-}}
-{{#each hits}}
-  <div class="{{containerClass}}">
-    <a href="#" id="{{detailLinkId}}" onclick="{{detailClick}}">
-      <b>{{md-title}}</b>
-    </a>
-    {{#if md-title-remainder}}
-      <span>{{md-title-remainder}}</span>
-    {{/if}}
-    {{#if md-title-responsibility}}
-      <span><i>{{md-title-responsibility}}</i></span>
-    {{/if}}
-    {{#if renderedDetails}}
-      {{{renderedDetails}}}
-    {{/if}}
-  </div>
-{{/each}}
diff --git a/src/templates/Reference.handlebars b/src/templates/Reference.handlebars
deleted file mode 100644 (file)
index cedad80..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-{{!
-Paragraphs and images from a reference source.
-
-sentences - number of sentences to include
-paragraphs - number of paragraphs to include
-md-* - metadata fields passed through from backend
-}}
-<img src="{{md-thumburl}}" alt="{{md-title}}">
-<h1><a href="{{md-electronic-url}}">{{md-title}}</a></h1>
-{{#if md-title-remainder}}
-<b>{{md-title-remainder}}</b>
-{{/if}}
-{{#if md-title-responsibility}}
-<i>{{md-title-responsibility}}</i>
-{{/if}}
-{{{mkws-paragraphs md-description paragraphs sentences}}}
-<p class="mkws-credit mkwsCredit">Wikipedia</p>
diff --git a/src/templates/Results.handlebars b/src/templates/Results.handlebars
deleted file mode 100644 (file)
index fcda1bc..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{{!
-Results -- compound widget to display search results
-
-team - team for this widget
-}}
-<table width="100%" border="0" cellpadding="6" cellspacing="0">
-  <tr>
-    <td class="mkws-termlists-container-wide mkws-team-{{team}}" width="250" valign="top">
-      <div class="mkws-termlists mkwsTermlists mkws-team-{{team}}"></div>
-    </td>
-    <td class="mkws-motd-container mkwsMOTDContainer mkws-team-{{team}}" valign="top">
-      <div class="mkws-ranking mkwsRanking mkws-team-{{team}}"></div>
-      <div class="mkws-pager mkwsPager mkws-team-{{team}}"></div>
-      <div class="mkws-navi mkwsNavi mkws-team-{{team}}"></div>
-      <div class="mkws-records mkwsRecords mkws-team-{{team}}"></div>
-    </td>
-  </tr>
-  <tr>
-    <td colspan="2">
-      <div class="mkws-termlists-container-narrow mkws-team-{{team}}"></div>
-    </td>
-  </tr>
-</table>
-
diff --git a/src/templates/Search.handlebars b/src/templates/Search.handlebars
deleted file mode 100644 (file)
index 82cbd15..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{{!
-Search form
-
-team - MKWS team
-queryWidth - configured width for search box
-}}
-<form name="mkws-search-form" class="mkws-search-form mkws-team-{{team}}" action="">
-  <input class="mkws-query mkws-query mkwsQuery mkws-team-{{team}}" type="text" size="{{queryWidth}}">
-  <input class="mkws-button mkws-button mkwsButton mkws-team-{{team}}" type="submit" value="{{{mkws-translate "Search"}}}">
-</form>
-
diff --git a/src/templates/Stat.handlebars b/src/templates/Stat.handlebars
deleted file mode 100644 (file)
index 340c1f8..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{{!
-Search statistics
-
-activeclients - number of targets currently searching
-clients - total targets for this search
-records - number of records returned and available
-hits - number of hits across all targets
-}}
- -- <span class="mkws-client-count mkwsClientCount">{{{mkws-translate "Active clients"}}} : {{activeclients}}/{{clients}}</span> -- {{{mkws-translate "Retrieved records"}}} : {{records}}/{{hits}}
diff --git a/src/templates/Switch.handlebars b/src/templates/Switch.handlebars
deleted file mode 100644 (file)
index 2b8e29c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{{!
-Switch between record and target view
-
-recordClick - handler to switch to record view
-targetClick - handler to switch to target view
-}}
-<a href="#" onclick="{{{recordClick}}}">{{{mkws-translate "Records"}}}</a>
-<span>|</span>
-<a href="#" onclick="{{{targetClick}}}">{{{mkws-translate "Targets"}}}</a>
diff --git a/src/templates/Targets.handlebars b/src/templates/Targets.handlebars
deleted file mode 100644 (file)
index 132f87f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-{{!
-Target detail
-
-data:
-  id - target id, an opaque identifier
-  hits - number of hits for this target, or "Error" if an error has occurred
-  diagnostic - diagnostic code returned by target, if any. May be numeric or human-readable
-  records - number of record retrieved from target
-  state - target state (Client_Idle, Client_Working, Client_Disconnected or Client_Error)
-}}
-<table>
-  <thead>
-    <tr>
-      <td>{{{mkws-translate "Target ID"}}}</td>
-      <td>{{{mkws-translate "Hits"}}}</td>
-      <td>{{{mkws-translate "Diags"}}}</td>
-      <td>{{{mkws-translate "Records"}}}</td>
-      <td>{{{mkws-translate "State"}}}</td>
-      </td>
-    </tr>
-  </thead>
-  <tbody>
-  {{#each data}}
-    <tr>
-      <td>{{{id}}}</td>
-      <td>{{hits}}</td>
-      <td>{{diagnostic}}</td>
-      <td>{{records}}</td>
-      <td>{{state}}</td>
-    </tr>
-  {{/each}}
-  </tbody>
-</table>
diff --git a/src/templates/Termlists.handlebars b/src/templates/Termlists.handlebars
deleted file mode 100644 (file)
index 66caa83..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{{!
-Termlists, a container of all configured facets.
-
-team - the current team
-facets - array of facet names
-}}
-
-<div class="mkws-termlists-title mkwsTermlistsTitle">Termlists</div>
-{{#each facets}}
-  <div class="mkws-facet mkwsFacet mkws-team-{{../team}}" data-mkws-facet="{{this}}"></div>
-{{/each}}
diff --git a/src/templates/details.handlebars b/src/templates/details.handlebars
new file mode 100644 (file)
index 0000000..9e8184e
--- /dev/null
@@ -0,0 +1,61 @@
+{{!
+Full record display.
+
+Top level object is metadata from Service Proxy / Pazpar2
+}}
+<table>
+  <tr>
+    <th>{{mkws-translate "Title"}}</th>
+    <td>
+      {{md-title}}
+      {{#if md-title-remainder}}
+        ({{md-title-remainder}})
+      {{/if}}
+      {{#if md-title-responsibility}}
+        <i>{{md-title-responsibility}}</i>
+      {{/if}}
+    </td>
+  </tr>
+  {{#if md-date}}
+  <tr>
+    <th>{{mkws-translate "Date"}}</th>
+    <td>{{md-date}}</td>
+  </tr>
+  {{/if}}
+  {{#if md-author}}
+  <tr>
+    <th>{{mkws-translate "Author"}}</th>
+    <td>{{md-author}}</td>
+  </tr>
+  {{/if}}
+  {{#if md-electronic-url}}
+  <tr>
+    <th>{{mkws-translate "Links"}}</th>
+    <td>
+      {{#each md-electronic-url}}
+        <a href="{{this}}">Link{{mkws-index1}}</a>
+      {{/each}}
+    </td>
+  </tr>
+  {{/if}}
+  {{#mkws-if-any location having="md-subject"}}
+  <tr>
+    <th>{{mkws-translate "Subject"}}</th>
+    <td>
+      {{#mkws-first location having="md-subject"}}
+        {{#if md-subject}}
+          {{#mkws-commaList md-subject}}
+            {{this}}{{/mkws-commaList}}
+        {{/if}}
+      {{/mkws-first}}
+    </td>
+  </tr>
+  {{/mkws-if-any}}
+  <tr>
+    <th>{{mkws-translate "Locations"}}</th>
+    <td>
+      {{#mkws-commaList location}}
+        {{mkws-attr "@name"}}{{/mkws-commaList}}
+    </td>
+  </tr>
+</table>
diff --git a/src/templates/done.handlebars b/src/templates/done.handlebars
new file mode 100644 (file)
index 0000000..59a0b4f
--- /dev/null
@@ -0,0 +1,7 @@
+{{!
+Displayed on search completion
+
+count - number of results found
+}}
+{{{mkws-translate "Search complete: found"}}} {{count}} {{{mkws-translate "records"}}}
+
diff --git a/src/templates/facet.handlebars b/src/templates/facet.handlebars
new file mode 100644 (file)
index 0000000..7a4eedf
--- /dev/null
@@ -0,0 +1,18 @@
+{{!
+A facet in the search.
+
+name - facet identifier, typically English and lowercase
+caption - caption for this facet
+terms:
+  term - term name
+  count - count of items matching in the current search for this team
+  linkdata - attributes to add to the term element including an onclick handler
+  field - for the xtargets facet ONLY, the opaque identifier of the target
+}}
+
+<div class="mkws-facet-title mkwsFacetTitle">{{caption}}</div>
+{{#each terms}}
+  <div class="mkws-term mkwsTerm">
+    <a href="#" {{{linkdata}}}>{{term}}</a> <span>{{count}}</span>
+  </div>
+{{/each}}
diff --git a/src/templates/image.handlebars b/src/templates/image.handlebars
new file mode 100644 (file)
index 0000000..f74f174
--- /dev/null
@@ -0,0 +1,21 @@
+{{!
+Records presented as images.
+
+The non-metadata keys enable an optional link to display an AJAX popup that
+fetches additional record detail.
+
+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
+  md-* - metadata fields passed through from backend
+}}
+{{#each hits}}
+  <a href="#" id="{{detailLinkId}}" onclick="{{detailClick}}">
+    {{#mkws-first md-thumburl}}
+      <img src="{{this}}" alt="{{../md-title}}"/>
+    {{/mkws-first}}
+    <br/>
+  </a>
+{{/each}}
diff --git a/src/templates/lang.handlebars b/src/templates/lang.handlebars
new file mode 100644 (file)
index 0000000..26ee6da
--- /dev/null
@@ -0,0 +1,19 @@
+{{!
+Language selection widget
+
+languages
+  code - two character language identifier
+  selected - exists for the current language
+  url - url to switch to this language
+}}
+{{#each languages}}
+  {{~#if selected~}}
+    <span>{{code}}</span>
+  {{~else~}}
+    <a href="{{{url}}}">{{code}}</a>
+  {{~/if~}}
+  {{#unless last}}
+    |
+  {{/unless}}
+{{/each}}
+
diff --git a/src/templates/navi.handlebars b/src/templates/navi.handlebars
new file mode 100644 (file)
index 0000000..5139fd7
--- /dev/null
@@ -0,0 +1,13 @@
+{{!
+Facet breadcrumbs -- filters on the current search
+
+filters
+  facet - name of facet being limited
+  value - limit to this value
+  click - handler script to remove limit
+}}
+{{#each filters}}
+  {{{mkws-translate facet}}}: <a class="mkws-removable mkwsRemovable" href="#" onclick="{{{click}}}">{{value}}</a>
+  {{#unless @last}}|{{/unless}}
+{{/each}}
+
diff --git a/src/templates/pager.handlebars b/src/templates/pager.handlebars
new file mode 100644 (file)
index 0000000..55768e8
--- /dev/null
@@ -0,0 +1,46 @@
+{{!
+Pager
+
+nextClick - handler script for "next" button, only available if there is a next page
+prevClick - handler script for "previous" button if there is a previous page
+moreNext - indicates there are more pages following those displayed
+morePrev - indicates there are more pages preceding
+first - first record displayed
+last - last record displayed
+count - number of records available
+found - number of records found
+pages:
+  number - page number
+  click - script to go to this page unless it is the current one
+}}
+<div style="float: right">
+  {{mkws-translate "Displaying"}}:
+  {{first}} {{mkws-translate "to"}} {{last}}
+  {{mkws-translate "of"}} {{count}} ({{{mkws-translate "found"}}}: {{found}})
+</div>
+
+<div style="float: clear">
+  {{#if prevClick}}
+    <a href="#" class="mkws-prev mkwsPrev" onclick="{{prevClick}}">&#60;&#60; {{{mkws-translate "Prev"}}}</a> |
+  {{else}}
+    <span class="mkws-prev mkwsPrev">&#60;&#60; {{{mkws-translate "Prev"}}}</span> |
+  {{/if}}
+
+  {{#if morePrev}}...{{/if}}
+
+  {{#each pages}}
+    {{#if click}}
+      <a href="#" onclick="{{click}}">{{number}}</a>
+    {{else}}
+      <span class="mkws-current-page mkwsCurrentPage">{{number}}</span>
+    {{/if}}
+  {{/each}}
+
+  {{#if moreNext}}...{{/if}}
+
+  {{#if nextClick}}
+    | <a href="#" class="mkws-next mkwsNext" onclick="{{nextClick}}">{{{mkws-translate "Next"}}} &#62;&#62;</a>
+  {{else}}
+    | <span class="mkws-next mkwsNext">{{{mkws-translate "Next"}}} &#62;&#62;</span>
+  {{/if}}
+</div>
diff --git a/src/templates/progress.handlebars b/src/templates/progress.handlebars
new file mode 100644 (file)
index 0000000..603c5ca
--- /dev/null
@@ -0,0 +1,11 @@
+{{!
+Progress
+
+done - number of targets complete
+waiting - number of targets waiting
+}}
+<span class="mkws-done mkws-done mkwsDone">{{#mkws-repeat done}}&#x2588;{{/mkws-repeat}}</span>
+{{~#if waiting~}}
+<span class="mkws-waiting mkws-waiting mkwsWaiting">{{#mkws-repeat waiting}}&#x2588;{{/mkws-repeat}}</span>
+{{~/if~}}
+
diff --git a/src/templates/ranking.handlebars b/src/templates/ranking.handlebars
new file mode 100644 (file)
index 0000000..890e29a
--- /dev/null
@@ -0,0 +1,42 @@
+{{!
+Ranking -- widget to select sort ordering and number of records to display
+
+team - team for this widget
+showSort - set if sort control is to be displayed
+showPerPage - set if per-page control is to be displayed
+sort
+  key - machine readable value for this sort option
+  label - text to display for this sort option
+  selected - exists if this sort is selected
+perPage
+  perPage - a number of records per page that can be selected
+  selected - exists if this number is the current selection
+}}
+<form>
+  {{~#if showSort~}}
+    {{{mkws-translate "Sort by"}}}
+    <select class="mkws-sort mkwsSort mkws-team-{{team}}">
+      {{#each sort}}
+        {{#if selected}}
+          <option value="{{{key}}}" selected="selected">{{{mkws-translate label}}}</option>
+        {{else}}
+          <option value="{{key}}">{{{mkws-translate label}}}</option>
+        {{/if}}
+      {{/each}}  
+    </select>
+  {{~/if~}}
+  {{~#if showPerPage}}
+    {{{mkws-translate "and show"}}}
+    <select class="mkws-perpage mkwsPerpage mkws-team-{{team}}">
+      {{#each perPage}}
+        {{#if selected}}
+          <option value="{{perPage}}" selected="selected">{{perPage}}</option>
+        {{else}}
+          <option value="{{perPage}}">{{perPage}}</option>
+        {{/if}}
+      {{/each}}  
+    </select>
+    {{{mkws-translate "per page"}}}
+  {{~/if~}}
+</form>
+
diff --git a/src/templates/records.handlebars b/src/templates/records.handlebars
new file mode 100644 (file)
index 0000000..3e1b3a7
--- /dev/null
@@ -0,0 +1,29 @@
+{{!
+Records from a search.
+
+The non-metadata keys enable an optional link to display an AJAX popup that
+fetches additional record detail.
+
+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
+  md-* - metadata fields passed through from backend
+}}
+{{#each hits}}
+  <div class="{{containerClass}}">
+    <a href="#" id="{{detailLinkId}}" onclick="{{detailClick}}">
+      <b>{{md-title}}</b>
+    </a>
+    {{#if md-title-remainder}}
+      <span>{{md-title-remainder}}</span>
+    {{/if}}
+    {{#if md-title-responsibility}}
+      <span><i>{{md-title-responsibility}}</i></span>
+    {{/if}}
+    {{#if renderedDetails}}
+      {{{renderedDetails}}}
+    {{/if}}
+  </div>
+{{/each}}
diff --git a/src/templates/reference.handlebars b/src/templates/reference.handlebars
new file mode 100644 (file)
index 0000000..cedad80
--- /dev/null
@@ -0,0 +1,17 @@
+{{!
+Paragraphs and images from a reference source.
+
+sentences - number of sentences to include
+paragraphs - number of paragraphs to include
+md-* - metadata fields passed through from backend
+}}
+<img src="{{md-thumburl}}" alt="{{md-title}}">
+<h1><a href="{{md-electronic-url}}">{{md-title}}</a></h1>
+{{#if md-title-remainder}}
+<b>{{md-title-remainder}}</b>
+{{/if}}
+{{#if md-title-responsibility}}
+<i>{{md-title-responsibility}}</i>
+{{/if}}
+{{{mkws-paragraphs md-description paragraphs sentences}}}
+<p class="mkws-credit mkwsCredit">Wikipedia</p>
diff --git a/src/templates/results.handlebars b/src/templates/results.handlebars
new file mode 100644 (file)
index 0000000..fcda1bc
--- /dev/null
@@ -0,0 +1,24 @@
+{{!
+Results -- compound widget to display search results
+
+team - team for this widget
+}}
+<table width="100%" border="0" cellpadding="6" cellspacing="0">
+  <tr>
+    <td class="mkws-termlists-container-wide mkws-team-{{team}}" width="250" valign="top">
+      <div class="mkws-termlists mkwsTermlists mkws-team-{{team}}"></div>
+    </td>
+    <td class="mkws-motd-container mkwsMOTDContainer mkws-team-{{team}}" valign="top">
+      <div class="mkws-ranking mkwsRanking mkws-team-{{team}}"></div>
+      <div class="mkws-pager mkwsPager mkws-team-{{team}}"></div>
+      <div class="mkws-navi mkwsNavi mkws-team-{{team}}"></div>
+      <div class="mkws-records mkwsRecords mkws-team-{{team}}"></div>
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2">
+      <div class="mkws-termlists-container-narrow mkws-team-{{team}}"></div>
+    </td>
+  </tr>
+</table>
+
diff --git a/src/templates/search.handlebars b/src/templates/search.handlebars
new file mode 100644 (file)
index 0000000..82cbd15
--- /dev/null
@@ -0,0 +1,11 @@
+{{!
+Search form
+
+team - MKWS team
+queryWidth - configured width for search box
+}}
+<form name="mkws-search-form" class="mkws-search-form mkws-team-{{team}}" action="">
+  <input class="mkws-query mkws-query mkwsQuery mkws-team-{{team}}" type="text" size="{{queryWidth}}">
+  <input class="mkws-button mkws-button mkwsButton mkws-team-{{team}}" type="submit" value="{{{mkws-translate "Search"}}}">
+</form>
+
diff --git a/src/templates/stat.handlebars b/src/templates/stat.handlebars
new file mode 100644 (file)
index 0000000..340c1f8
--- /dev/null
@@ -0,0 +1,9 @@
+{{!
+Search statistics
+
+activeclients - number of targets currently searching
+clients - total targets for this search
+records - number of records returned and available
+hits - number of hits across all targets
+}}
+ -- <span class="mkws-client-count mkwsClientCount">{{{mkws-translate "Active clients"}}} : {{activeclients}}/{{clients}}</span> -- {{{mkws-translate "Retrieved records"}}} : {{records}}/{{hits}}
diff --git a/src/templates/switch.handlebars b/src/templates/switch.handlebars
new file mode 100644 (file)
index 0000000..2b8e29c
--- /dev/null
@@ -0,0 +1,9 @@
+{{!
+Switch between record and target view
+
+recordClick - handler to switch to record view
+targetClick - handler to switch to target view
+}}
+<a href="#" onclick="{{{recordClick}}}">{{{mkws-translate "Records"}}}</a>
+<span>|</span>
+<a href="#" onclick="{{{targetClick}}}">{{{mkws-translate "Targets"}}}</a>
diff --git a/src/templates/targets.handlebars b/src/templates/targets.handlebars
new file mode 100644 (file)
index 0000000..132f87f
--- /dev/null
@@ -0,0 +1,33 @@
+{{!
+Target detail
+
+data:
+  id - target id, an opaque identifier
+  hits - number of hits for this target, or "Error" if an error has occurred
+  diagnostic - diagnostic code returned by target, if any. May be numeric or human-readable
+  records - number of record retrieved from target
+  state - target state (Client_Idle, Client_Working, Client_Disconnected or Client_Error)
+}}
+<table>
+  <thead>
+    <tr>
+      <td>{{{mkws-translate "Target ID"}}}</td>
+      <td>{{{mkws-translate "Hits"}}}</td>
+      <td>{{{mkws-translate "Diags"}}}</td>
+      <td>{{{mkws-translate "Records"}}}</td>
+      <td>{{{mkws-translate "State"}}}</td>
+      </td>
+    </tr>
+  </thead>
+  <tbody>
+  {{#each data}}
+    <tr>
+      <td>{{{id}}}</td>
+      <td>{{hits}}</td>
+      <td>{{diagnostic}}</td>
+      <td>{{records}}</td>
+      <td>{{state}}</td>
+    </tr>
+  {{/each}}
+  </tbody>
+</table>
diff --git a/src/templates/termlists.handlebars b/src/templates/termlists.handlebars
new file mode 100644 (file)
index 0000000..66caa83
--- /dev/null
@@ -0,0 +1,11 @@
+{{!
+Termlists, a container of all configured facets.
+
+team - the current team
+facets - array of facet names
+}}
+
+<div class="mkws-termlists-title mkwsTermlistsTitle">Termlists</div>
+{{#each facets}}
+  <div class="mkws-facet mkwsFacet mkws-team-{{../team}}" data-mkws-facet="{{this}}"></div>
+{{/each}}