Edgewall Software
Modify

Ticket #924 (closed defect: fixed)

Opened 7 years ago

Last modified 5 months ago

[PATCH] Value of custom checkbox fields are not displayed properly

Reported by: pkou <pkou at ua.fm> Owned by: cboos
Priority: normal Milestone: 0.11
Component: ticket system Version: devel
Severity: minor Keywords: custom fields
Cc:
Release Notes:
API 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

patch-customcbshow-r1049.diff (664 bytes) - added by pkou <pkou at ua.fm> 7 years ago.
Patch for the defect

Download all attachments as: .zip

Change History

Changed 7 years ago by pkou <pkou at ua.fm>

Patch for the defect

comment:1 Changed 5 years ago by sid

See also #2306.

comment:2 Changed 5 years ago by cboos

  • Keywords custom fields added
  • Milestone set to 1.0
  • Severity changed from trivial to minor

comment:3 Changed 5 years ago by sid

#2306 was marked as duplicate of this ticket. It also has a patch.

comment:4 Changed 5 years ago by cboos

  • Milestone changed from 1.0 to 0.11
  • Owner changed from jonas to cboos

This is fixed in the FieldRefactoring branch (check the notifications though).

comment:5 Changed 4 years ago by cboos

  • Milestone changed from 0.11.1 to 0.11
  • Resolution set to fixed
  • Status changed from new to closed

Implemented in r5812, r5813.

comment:6 Changed 5 months ago by anonymous

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 Changed 5 months ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:8 Changed 5 months ago by anonymous

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 '&#x2713;' 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 Changed 5 months ago by rblank

  • Resolution set to fixed
  • Status changed from reopened to 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.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.