webstaff: implement action to cancel creating new pattern
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 5 May 2017 21:49:05 +0000 (17:49 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 May 2017 16:06:41 +0000 (12:06 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2
Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js

index c0ad70d..5a95ff1 100644 (file)
@@ -7,9 +7,9 @@
     <button class="btn btn-warning" ng-click="startNewScap()">[% l('Add New') %]</button>
     <button class="btn btn-warning" ng-click="importScapFromBibRecord()">[% l('Import from Bibliographic and/or MFHD Records') %]</button>
   </div>
-  <div ng-if="new_prediction">
+  <div class="row" ng-if="new_prediction">
     <ng-form name="new_prediction.predform" class="form-inline">
-      <div class="col-md-1"><label>[% l('ID') %] {{new_prediction.id}}</label></div>
+      <div class="col-md-1"></div>
       <div class="col-md-1">
         <label class="checkbox-inline">
           <input type="checkbox" ng-model="new_prediction.active">[% l('Active') %]
@@ -29,6 +29,7 @@
           <button class="btn btn-default" ng-click="openPatternEditorDialog(new_prediction)">[% l('Create Pattern') %]</button>
         </div>
       <div>
+          <button type="submit" class="btn btn-default" ng-click="cancelNewScap()">[% l('Cancel') %]</button>
           <button type="submit" class="btn btn-primary" ng-disabled="!new_prediction.predform.$dirty" ng-click="createScap(new_prediction)">[% l('Create') %]</button>
       </div>
     </form>
index 8066cbf..c707351 100644 (file)
@@ -65,13 +65,15 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
         });
     }
 
+    $scope.cancelNewScap = function() {
+        $scope.new_prediction = null;
+    }
     $scope.startNewScap = function() {
         $scope.new_prediction = egCore.idl.toTypedHash(new egCore.idl.scap());
         $scope.new_prediction.type = 'basic';
         $scope.new_prediction.active = true;
         $scope.new_prediction.create_date = new Date();
         $scope.new_prediction.subscription = $scope.ssubId;
-        $scope.new_pred = {};
     }
 
     $scope.importScapFromBibRecord = function() {