start adding form validation to receipt template editor
authorGalen Charlton <gmc@esilibrary.com>
Wed, 10 Aug 2016 16:10:58 +0000 (12:10 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 18 Aug 2016 19:34:22 +0000 (15:34 -0400)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/templates/staff/css/style.css.tt2
Open-ILS/src/templates/staff/reporter/t_edit_template.tt2

index fb06c0e..93881b6 100644 (file)
 .form-validated input.ng-valid.ng-dirty {
   background-color: #78FA89;
 }
-.form-validated input.ng-invalid-required {
-  background-color: #FACDCF;
+.form-validated textarea.ng-invalid.ng-dirty {
+  background-color: #FA787E;
+}
+.form-validated textarea.ng-valid.ng-dirty {
+  background-color: #78FA89;
 }
 
 /* --------------------------------------------------------------------------
index cd8b74a..fbb266d 100644 (file)
@@ -1,11 +1,12 @@
 <!-- report template builder -->
+<ng-form name="reportTemplateForm" class="form-validated">
 
 <div class="row">
   <div class="col-md-2">
     [% l('Template Name') %]
   </div>
   <div class="col-md-4">
-    <div><input type="text" class="form-control" ng-model="templateName"/></div>
+    <div><input type="text" class="form-control" ng-model="templateName" required/></div>
   </div>
   <div class="col-md-2">
     [% l('Documentation URL') %]
     [% l('Template Description') %]
   </div>
   <div class="col-md-10">
-    <div><textarea class="form-control" ng-model="templateDescription"/></div>
+    <div><textarea class="form-control" ng-model="templateDescription" required/></div>
   </div>
 </div>
 
 <div class="row">
   <div class="col-md-2">
-    <button ng-click="saveTemplate()" class="btn btn-default">[% l('Save Template') %]</button>
+    <button ng-disabled="reportTemplateForm.$invalid" ng-click="saveTemplate()" class="btn btn-default">[% l('Save Template') %]</button>
   </div>
 </div>
+</ng-form>
 
 <hr/>