in run_auto_searches(), if query is undefined, don't examine it for
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 0cfea64..58fa52e 100644 (file)
@@ -65,6 +65,11 @@ Handlebars.registerHelper('commaList', function(items, options) {
 });
 
 
+Handlebars.registerHelper('index1', function(obj) {
+    return obj.data.index + 1;
+});
+
+
 
 // Set up global mkws object. Contains truly global state such as SP
 // authentication, and a hash of team objects, indexed by windowid.
@@ -805,10 +810,10 @@ function team($, teamName) {
   {{/if}}\
   {{#if md-electronic-url}}\
   <tr>\
-    <th>{{translate "URL"}}</th>\
+    <th>{{translate "Links"}}</th>\
     <td>\
       {{#each md-electronic-url}}\
-       <a href="{{this}}">{{this}}</a><br/>\
+       <a href="{{this}}">Link{{index1}}</a>\
       {{/each}}\
     </td>\
   </tr>\
@@ -819,7 +824,8 @@ function team($, teamName) {
     <td>\
       {{#first location having="md-subject"}}\
        {{#if md-subject}}\
-         {{md-subject}}\
+         {{#commaList md-subject}}\
+           {{this}}{{/commaList}}\
        {{/if}}\
       {{/first}}\
     </td>\
@@ -1310,6 +1316,8 @@ function team($, teamName) {
            // ### should check mkwsTermlist as well, for facet-only teams
            var node = $('.mkwsRecords.mkwsTeam_' + teamName);
            var query = node.attr('autosearch');
+           if (!query)
+               continue;
 
            if (query.match(/^!param!/)) {
                var param = query.replace(/^!param!/, '');
@@ -1330,18 +1338,16 @@ function team($, teamName) {
 
            debug("teamName '" + teamName + "', node=" + node + ", class='" + node.className + "', query=" + query);
 
-           if (query) {
-               var sort = node.attr('sort');
-               var targets = node.attr('targets');
-               var s = "running auto search: '" + query + "'";
-               if (teamName) s += " [teamName '" + teamName + "']";
-               if (sort) s += " sorted by '" + sort + "'";
-               if (targets) s += " in targets '" + targets + "'";
-               debug(s);
-               var team = mkws.teams[teamName];
-               debug($.toJSON(team));
-               team.newSearch(query, sort, targets, teamName);
-           }
+           var sort = node.attr('sort');
+           var targets = node.attr('targets');
+           var s = "running auto search: '" + query + "'";
+           if (teamName) s += " [teamName '" + teamName + "']";
+           if (sort) s += " sorted by '" + sort + "'";
+           if (targets) s += " in targets '" + targets + "'";
+           debug(s);
+           var team = mkws.teams[teamName];
+           debug($.toJSON(team));
+           team.newSearch(query, sort, targets, teamName);
        }
     }