]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 566331: Move JS functions out of bug/edit.html.tmpl
authorIshitva Goel <ishitva.goel@yahoo.co.in>
Mon, 10 Mar 2014 14:08:57 +0000 (15:08 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 10 Mar 2014 14:08:57 +0000 (15:08 +0100)
r=LpSolit a=justdave

js/field.js
template/en/default/bug/edit.html.tmpl

index 51fd1fe86e5cec4b1732aec6f793a5ef12bd160a..892c8669f6cd946445931a6554a7e4cdd322bd20 100644 (file)
@@ -1070,3 +1070,16 @@ function show_comment_edit() {
     YAHOO.util.Dom.addClass(comment_tab, 'active_comment_tab');
     comment_tab.setAttribute('aria-selected', 'true');
 }
+
+function adjustRemainingTime() {
+    // subtracts time spent from remaining time
+    // prevent negative values if work_time > bz_remaining_time
+    var new_time = Math.max(bz_remaining_time - document.changeform.work_time.value, 0.0);
+    // get upto 2 decimal places
+    document.changeform.remaining_time.value = Math.round(new_time * 100)/100;
+}
+
+function updateRemainingTime() {
+    // if the remaining time is changed manually, update bz_remaining_time
+    bz_remaining_time = document.changeform.remaining_time.value;
+}
index 3a2a81d8e06969bb57119db39e50965335518e6e..61fa2c1ec61cc62a4deeca26a1f080ec40bd6821 100644 (file)
 <script type="text/javascript">
 <!--
 [% IF user.is_timetracker %]
-  var fRemainingTime = [% bug.remaining_time %]; // holds the original value
-  function adjustRemainingTime() {
-      // subtracts time spent from remaining time
-      var new_time;
-
-      // prevent negative values if work_time > fRemainingTime
-      new_time =
-          Math.max(fRemainingTime - document.changeform.work_time.value, 0.0);
-      // get upto 2 decimal places
-      document.changeform.remaining_time.value =
-          Math.round(new_time * 100)/100;
-  }
-
-  function updateRemainingTime() {
-      // if the remaining time is changed manually, update fRemainingTime
-      fRemainingTime = document.changeform.remaining_time.value;
-  }
+  var bz_remaining_time = [% bug.remaining_time %];
 [% END %]
 
 [% IF user.id %]