Opened 20 years ago
Closed 13 years ago
#924 closed defect (fixed)
[PATCH] Value of custom checkbox fields are not displayed properly
Reported by: | pkou <pkou at ua.fm> | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | ticket system | Version: | devel |
Severity: | minor | Keywords: | custom fields |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Custom fields with checkbox type are not displayed properly on ticket summary screen:
- When the value of a checkbox is OFF, nothing is displayed;
- When the value of a checkbox is ON, 1 is displayed.
Attached patch fixes the defect by displaying No and Yes appropriately.
Attachments (1)
Change History (10)
by , 20 years ago
Attachment: | patch-customcbshow-r1049.diff added |
---|
comment:2 by , 18 years ago
Keywords: | custom fields added |
---|---|
Milestone: | → 1.0 |
Severity: | trivial → minor |
comment:4 by , 17 years ago
Milestone: | 1.0 → 0.11 |
---|---|
Owner: | changed from | to
This is fixed in the FieldRefactoring branch (check the notifications though).
comment:5 by , 17 years ago
Milestone: | 0.11.1 → 0.11 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:6 by , 13 years ago
This fix is completely stupid.
I just defined some checkbox fields in Trac. I updated some tickets with values for these checkboxes. Then I noticed, lo and behold, they display as "yes" or "no", and not checkboxes.
This is not the object I defined. I defined a checkbox, damn it! So, by golly, I want to see a checkbox.
The checkboxes represent approval for an item. A clear checkbox means "abstained from approving". But "no" strongly suggests "disapproved".
comment:7 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:8 by , 13 years ago
I am not able to fix it. The following patch escapes my HTML. Unicode also doesn't work, because some object complains about non-ASCII bytes in the stream:
--- pyshared.orig/trac/ticket/web_ui.py 2011-09-16 11:59:40.000000000 -0700 +++ pyshared/trac/ticket/web_ui.py 2011-09-16 12:04:59.000000000 -0700 @@ -1120,7 +1120,7 @@ elif type_ == 'checkbox': value = ticket.values.get(name) if value in ('1', '0'): - field['rendered'] = value == '1' and _('yes') or _('no') + field['rendered'] = value == '1' and '✓' or '' # ensure sane defaults field.setdefault('optional', False)
The quick and dirty idea was just to render a Unicode checkmark, or leave it blank.
How can I express to the Python code that I would like raw HTML?
I don't want to learn the entire internals of Trac just to solve this. (I have only about 30 more minutes in total that I can spend on this issue, unfortunately.)
comment:9 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Reopening a 7 year old ticket fixed 4 years ago and complaining loudly won't get you anywhere. If you want something changed, please open a new enhancement request and describe in an appropriate language what you want and why it's better than the current state.
Patch for the defect