LP#1788417: boolean fields should say 'Yes'/'No' instead of true/false
authora. bellenir <ab@grpl.org>
Wed, 22 Aug 2018 15:33:55 +0000 (11:33 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 22 Aug 2018 16:59:08 +0000 (12:59 -0400)
boolean fields on egGrid use tt2-translated strings for "Yes" and "No"
instead of letting the browser translate the values 'true' and 'false'
(in accordance with the prophecy of XUL)

Signed-off-by: a. bellenir <ab@grpl.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/templates/staff/base_js.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 1feeef0..552849f 100644 (file)
@@ -212,6 +212,8 @@ UpUp.start({
     s.CONFIRM_IN_HOUSE_NUM_USES_COUNT_TITLE = "[% l('Are you sure you want to record {{num_uses}} uses for this?') %]";
     s.PAGE_TITLE_DEFAULT = "[% l('Evergreen Staff Client') %]";
     s.PAGE_TITLE_DYNAMIC_AND_CONTEXT = "[% l('[_1] - [_2]', '{{dynamic}}', '{{context}}') %]";
+    s.YES = "[% l('Yes') %]";
+    s.NO = "[% l('No') %]";
   }]);
 </script>
 
index ae97efd..bf421c1 100644 (file)
@@ -2050,11 +2050,10 @@ angular.module('egGridMod',
 /**
  * Translates bare IDL object values into display values.
  * 1. Passes dates through the angular date filter
- * 2. Translates bools to Booleans so the browser can display translated 
- *    value.  (Though we could manually translate instead..)
+ * 2. Converts bools to translated Yes/No strings
  * Others likely to follow...
  */
-.filter('egGridValueFilter', ['$filter','egCore', function($filter,egCore) {
+.filter('egGridValueFilter', ['$filter','egCore', 'egStrings', function($filter,egCore,egStrings) {
     function traversePath(obj,path) {
         var list = path.split('.');
         for (var part in path) {
@@ -2072,11 +2071,11 @@ angular.module('egGridMod',
                     case 't' : 
                     case '1' :  // legacy
                     case true:
-                        return ''+true;
+                        return egStrings.YES;
                     case 'f' : 
                     case '0' :  // legacy
                     case false:
-                        return ''+false;
+                        return egStrings.NO;
                     // value may be null,  '', etc.
                     default : return '';
                 }