perpage_default should work without select menu, MKWS-51
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index ef15687..e3ca0e1 100644 (file)
@@ -108,6 +108,12 @@ Handlebars.registerHelper('json', function(obj) {
 });
 
 
+Handlebars.registerHelper('translate', function(s) {
+    debug("translating '" + s + "'");
+    return M(s);
+});
+
+
 // We need {{attr '@name'}} because Handlebars can't parse {{@name}}
 Handlebars.registerHelper('attr', function(attrName) {
     return this[attrName];
@@ -201,6 +207,7 @@ Handlebars.registerHelper('commaList', function(items, options) {
     }
 }
 
+
 mkws.sort = mkws_config.sort_default;
 debug("copied mkws_config.sort_default '" + mkws_config.sort_default + "' to mkws.sort");
 
@@ -251,6 +258,10 @@ var SourceMax = 16;
 var SubjectMax = 10;
 var AuthorMax = 10;
 
+if ($.isNumeric(mkws_config.perpage_default)) {
+    recPerPage = parseInt(mkws_config.perpage_default);
+}
+
 //
 // pz2.js event handlers:
 //
@@ -782,7 +793,7 @@ function defaultTemplate(name)
        return '\
       <table>\
        <tr>\
-         <th>Title</th>\
+         <th>{{translate "Title"}}</th>\
          <td>\
            {{md-title}}\
            {{#if md-title-remainder}}\
@@ -795,19 +806,19 @@ function defaultTemplate(name)
        </tr>\
        {{#if md-date}}\
        <tr>\
-         <th>Date</th>\
+         <th>{{translate "Date"}}</th>\
          <td>{{md-date}}</td>\
        </tr>\
        {{/if}}\
        {{#if md-author}}\
        <tr>\
-         <th>Author</th>\
+         <th>{{translate "Author"}}</th>\
          <td>{{md-author}}</td>\
        </tr>\
        {{/if}}\
        {{#if md-electronic-url}}\
        <tr>\
-         <th>URL</th>\
+         <th>{{translate "URL"}}</th>\
          <td>\
            {{#each md-electronic-url}}\
              <a href="{{this}}">{{this}}</a><br/>\
@@ -817,7 +828,7 @@ function defaultTemplate(name)
        {{/if}}\
        {{#if-any location having="md-subject"}}\
        <tr>\
-         <th>Subject</th>\
+         <th>{{translate "Subject"}}</th>\
          <td>\
            {{#first location having="md-subject"}}\
              {{#if md-subject}}\
@@ -828,7 +839,7 @@ function defaultTemplate(name)
        </tr>\
        {{/if-any}}\
        <tr>\
-         <th>Locations</th>\
+         <th>{{translate "Locations"}}</th>\
          <td>\
            {{#commaList location}}\
              {{attr "@name"}}{{/commaList}}\