Closed
Bug 512618
Opened 15 years ago
Closed 15 years ago
Bugzilla::Bug::choices should return Field::Choice objects, not just values
Categories
(Bugzilla :: Bugzilla-General, enhancement)
Tracking
()
RESOLVED
FIXED
Bugzilla 3.6
People
(Reporter: mkanat, Assigned: mkanat)
References
Details
Attachments
(1 file, 3 obsolete files)
6.12 KB,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
I'd like to start using choices(), more, everywhere, because it allows us to centralize "what values this user can set on this bug" in the backend code instead of the templates. However, right now field.html.tmpl expects Field::Choice objects, while choices() returns just values. So choices() should return Field::Choice objects instead, and also should really only load legal_values when they are asked for.
Assignee | ||
Comment 1•15 years ago
|
||
So, it turns out that there are very few things actually still using choices(). The [% BLOCK select %] in bug/edit.html.tmpl is now only used for per-product fields, and then choices() is also used to get valid resolutions. So I now only include information for those fields, in choices(), for now.
Updated•15 years ago
|
Attachment #396648 -
Flags: review?(LpSolit) → review-
Comment 2•15 years ago
|
||
Comment on attachment 396648 [details] [diff] [review] v1 (In reply to comment #0) > I'd like to start using choices(), more, everywhere I rather want to kill choices() entirely. We don't need it, really. Components, versions and milestones can already be obtained by [% bug.product.obj.$foo %] which has the same effect as [% bug.choices.$foo %]. You should fix [% BLOCK select %] to stop using choices(). This leaves us with a single place using bug.choices.product, which you introduced, and a single place using choices.resolution, which would partially be fixed by bug 106589. The logic about MOVED can remain where it is now.
Assignee | ||
Comment 3•15 years ago
|
||
Comment on attachment 396648 [details] [diff] [review] v1 (In reply to comment #2) > I rather want to kill choices() entirely. We don't need it, really. Well, *after* this bug, I'd be happy to get rid of choices(), if you want. I actually think it's somewhat useful given the current architecture of the code. I used to agree with you entirely, and I was actually originally going to kill choices() instead of just re-work it, but I found that the architecture, for now, was nicer with choices() than without. Also, this blocks a really important other enhancement, and it's also a nice cleanup of the existing code.
Attachment #396648 -
Flags: review- → review?(LpSolit)
Comment 4•15 years ago
|
||
Comment on attachment 396648 [details] [diff] [review] v1 So be sure to file a bug about killing choices() entirely. But for now, fix BLOCK select to use bug.product_obj.$selname instead of bug.choices.$selname, and remove the corresponding entries from choices().
Attachment #396648 -
Flags: review?(LpSolit) → review-
Assignee | ||
Comment 5•15 years ago
|
||
Okay, here you go.
Attachment #396648 -
Attachment is obsolete: true
Attachment #403714 -
Flags: review?(LpSolit)
Comment 6•15 years ago
|
||
Comment on attachment 403714 [details] [diff] [review] v2 >Index: template/en/default/bug/knob.html.tmpl >+ [% get_resolution(r.name) FILTER html %]</option> It conflicts with bug 512606, which I just reviewed and which removes get_resolution(). Could you unbitrot it and resubmit?
Comment 7•15 years ago
|
||
(In reply to comment #6) > It conflicts with bug 512606 I meant bug 512623.
Assignee | ||
Comment 8•15 years ago
|
||
Okay, unbitrotted.
Attachment #403714 -
Attachment is obsolete: true
Attachment #403897 -
Flags: review?(LpSolit)
Attachment #403714 -
Flags: review?(LpSolit)
Assignee | ||
Comment 9•15 years ago
|
||
It turns out that product_obj.${selname} doesn't match the field names. I've gone back to using choices instead, because that makes things much simpler in the templates (it actually matches up against the field names). At some point this will all be obsoleted by using bug/field.html.tmpl instead, and you can file a bug to do that if you'd like.
Attachment #403897 -
Attachment is obsolete: true
Attachment #403904 -
Flags: review?(LpSolit)
Attachment #403897 -
Flags: review?(LpSolit)
Comment 10•15 years ago
|
||
Comment on attachment 403904 [details] [diff] [review] v4 r=LpSolit
Attachment #403904 -
Flags: review?(LpSolit) → review+
Updated•15 years ago
|
Flags: approval+
Assignee | ||
Comment 11•15 years ago
|
||
Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.289; previous revision: 1.288 done Checking in template/en/default/bug/edit.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/bug/edit.html.tmpl,v <-- edit.html.tmpl new revision: 1.166; previous revision: 1.165 done Checking in template/en/default/bug/knob.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/bug/knob.html.tmpl,v <-- knob.html.tmpl new revision: 1.44; previous revision: 1.43 done
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•