[open-ils-commits] [GIT] Evergreen ILS branch master updated. 0d0e404f3bd0a357e1def316d1ab48fa4358b130

Evergreen Git git at git.evergreen-ils.org
Fri Aug 25 15:58:26 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  0d0e404f3bd0a357e1def316d1ab48fa4358b130 (commit)
      from  7b41b6654f124da9c6d3f3ce39c0f351c714c35d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0d0e404f3bd0a357e1def316d1ab48fa4358b130
Author: Jason Boyer <jboyer at library.in.gov>
Date:   Fri Aug 25 11:13:22 2017 -0400

    LP1713064: String / Float Value ACP Editor Fix
    
    Add an Angular directive to the vol/copy editor
    to convert and format numbers stored as strings
    in acp objects.
    
    Signed-off-by: Jason Boyer <jboyer at library.in.gov>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
index 70fac46..6e40e32 100644
--- a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
+++ b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
@@ -225,7 +225,7 @@
                     </select>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.price !== undefined}">
-                    <input class="form-control" ng-disabled="!defaults.attributes.price" ng-model="working.price" type="number"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.price" string-to-number precision="2" ng-model="working.price" type="number" step="0.01"/>
                 </div>
             </div>
 
@@ -249,7 +249,7 @@
                     </select>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.cost !== undefined}">
-                    <input class="form-control" ng-disabled="!defaults.attributes.cost" ng-model="working.cost" type="number"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.cost" string-to-number precision="2" ng-model="working.cost" type="number" step="0.01"/>
                 </div>
             </div>
 
@@ -319,7 +319,7 @@
                     </div>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.deposit_amount !== undefined}">
-                    <input class="form-control" ng-disabled="!defaults.attributes.deposit_amount" ng-model="working.deposit_amount" type="number"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.deposit_amount" string-to-number precision="2" ng-model="working.deposit_amount" type="number" step="0.01"/>
                 </div>
             </div>
 
diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js
index 19596b9..285f5e8 100644
--- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js
+++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js
@@ -328,6 +328,34 @@ function(egCore , $q) {
     return service;
 }])
 
+.directive('stringToNumber', function() {
+    return {
+        require: 'ngModel',
+        link: function(scope, element, attrs, ngModel) {
+            var precision = attrs.precision || 0;
+            ngModel.$parsers.push(function(value) {
+                return value;
+            });
+
+            function updateDisplay() {
+                var value = parseFloat(ngModel.$viewValue);
+                if ( isNaN(value) ) { return; }
+                    element.val(value.toFixed(precision));
+            }
+
+            ngModel.$formatters.push(function(value) {
+                return parseFloat(value);
+            });
+
+            ngModel.$viewChangeListeners.push(updateDisplay);
+
+            ngModel.$render = function() {
+                updateDisplay();
+            }
+        }
+    };
+})
+
 .directive("egVolCopyEdit", function () {
     return {
         restrict: 'E',

-----------------------------------------------------------------------

Summary of changes:
 .../templates/staff/cat/volcopy/t_attr_edit.tt2    |    6 ++--
 .../web/js/ui/default/staff/cat/volcopy/app.js     |   28 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list