LP1714390:Remove acp Editor Formatting Frustration
authorJason Boyer <jboyer@library.in.gov>
Fri, 1 Sep 2017 02:06:31 +0000 (22:06 -0400)
committerKathy Lussier <klussier@masslnc.org>
Wed, 29 Nov 2017 19:19:46 +0000 (14:19 -0500)
In bug 1713064 I added a directive to make it possible to use
a String as a Model in an Input tag with type Number. Unfortunately
there was also a formatting function in that branch that works well
sometimes but is far more frustrating than it is helpful for enough
workflows that it should be removed.

Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index bba9ab1..775c77b 100644 (file)
                     </select>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.price !== undefined}">
-                    <input class="form-control" ng-disabled="!defaults.attributes.price" string-to-number precision="2" ng-model="working.price" type="number" step="0.01"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.price" string-to-number ng-model="working.price" type="number" step="0.01"/>
                 </div>
             </div>
 
                     </select>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.cost !== undefined}">
-                    <input class="form-control" ng-disabled="!defaults.attributes.cost" string-to-number precision="2" ng-model="working.cost" type="number" step="0.01"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.cost" string-to-number ng-model="working.cost" type="number" step="0.01"/>
                 </div>
             </div>
 
                     </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" string-to-number precision="2" ng-model="working.deposit_amount" type="number" step="0.01"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.deposit_amount" string-to-number ng-model="working.deposit_amount" type="number" step="0.01"/>
                 </div>
             </div>
 
index 7fe8ddd..d856ce6 100644 (file)
@@ -450,26 +450,13 @@ function(egCore , $q) {
     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();
-            }
         }
     };
 })