Closed
Bug 566331
Opened 15 years ago
Closed 11 years ago
Move JS code out of bug/edit.html.tmpl
Categories
(Bugzilla :: Creating/Changing Bugs, enhancement)
Tracking
()
RESOLVED
FIXED
Bugzilla 5.0
People
(Reporter: LpSolit, Assigned: ishitva.goel)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
There is ~100 lines of JavaScript in bug/edit.html.tmpl. This code is pretty hard to read with all the english strings and TT code in it, and probably makes the life pretty difficult to localizers. This JS code should go somewhere into js/*.js, and relevant data passed to it (strings + bug data). Probably not an easy task.
Reporter | ||
Comment 1•13 years ago
|
||
Thanks to bug 653634, most of the JS functions defined in this template are gone. This leaves us with adjustRemainingTime() and updateRemainingTime() which could be moved into js/field.js, which is already loaded.
Depends on: 653634
Whiteboard: [Good Intro Bug]
Reporter | ||
Updated•11 years ago
|
Assignee: create-and-change → ishitva.goel
Status: NEW → ASSIGNED
Target Milestone: --- → Bugzilla 5.0
Assignee | ||
Comment 2•11 years ago
|
||
This patch removes the JS functions adjustRemainingTime() and updateRemainingTime() from bug/edit.html.tmpl and places them into js/field.js .
Also the variable name " fRemainingTime " is now changed to " bz_remaining_time " .
Attachment #8385139 -
Flags: review?(dkl)
Reporter | ||
Comment 3•11 years ago
|
||
Comment on attachment 8385139 [details] [diff] [review]
patch13d.diff
>=== modified file 'js/field.js'
>+var bz_remaining_time;
>+function adjustRemainingTime(bz_remaining_time_arg) {
>+ bz_remaining_time = bz_remaining_time_arg;
This won't work. bz_remaining_time_arg is going to override bz_remaining_time. This function takes no argument.
>+ var new_time;
>+ // prevent negative values if work_time > remainingTime
>+ new_time =
You can merge these lines into one: var new_time = ...
>+}
>\ No newline at end of file
Please add a newline at the end of the file.
>=== modified file 'template/en/default/bug/edit.html.tmpl'
>+ adjustRemainingTime([% bug.remaining_time %]);
>+ updateRemainingTime();
That's not the right time to call these functions. They are called later, triggered by onchange. You must also define bz_remaining_time here.
Attachment #8385139 -
Flags: review?(dkl) → review-
Assignee | ||
Comment 4•11 years ago
|
||
The patch fixes the issues mentioned in the comment 3 .
Attachment #8385245 -
Flags: review?(dkl)
Reporter | ||
Updated•11 years ago
|
Attachment #8385139 -
Attachment is obsolete: true
Reporter | ||
Comment 5•11 years ago
|
||
Comment on attachment 8385245 [details] [diff] [review]
patch13e.diff
>=== modified file 'js/field.js'
>+ // prevent negative values if work_time > remainingTime
s/remainingTime/bz_remaining_time/
>+ document.changeform.remaining_time.value =
>+ Math.round(new_time * 100)/100;
Nit: this could be written on a single line.
Works fine. r=LpSolit with these fixes on checkin.
Attachment #8385245 -
Flags: review?(dkl) → review+
Reporter | ||
Updated•11 years ago
|
Flags: approval?
Whiteboard: [Good Intro Bug]
Updated•11 years ago
|
Flags: approval? → approval+
Reporter | ||
Comment 6•11 years ago
|
||
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified js/field.js
modified template/en/default/bug/edit.html.tmpl
Committed revision 8955.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•