[open-ils-commits] [GIT] Evergreen ILS branch rel_2_12 updated. 50ff6275114ad156eb2b913c841b5d9740b7a432
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, rel_2_12 has been updated
via 50ff6275114ad156eb2b913c841b5d9740b7a432 (commit)
from 6066f441330108b99f160a80bef7fc63958356cc (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 50ff6275114ad156eb2b913c841b5d9740b7a432
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 12f1f77..d67c833 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 f2a6268..5e47bd3 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
@@ -327,6 +327,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