Edgewall Software
Modify

Opened 15 years ago

Last modified 2 years ago

#925 new enhancement

[PATCH] Allow wiki syntax in labels for custom fields

Reported by: pkou <pkou at ua.fm> Owned by:
Priority: normal Milestone: unscheduled
Component: ticket system Version: devel
Severity: normal Keywords: custom fields
Cc: m@…, shishz@… Branch:
Release Notes:
API Changes:

Description

The proposal is to add a possibility to use Wiki syntax in labels for custom fields.

Example 1: We need to put emphasis on Platform field

[ticket-custom]
platform         = select
platform.order   = 1
platform.label   = '''Platform'''
platform.options = |Intel P4|Intel XEON|AMD Athlon 64|Other

Example 2: We need to define a link to help screen for Platform field

[ticket-custom]
platform         = select
platform.order   = 1
platform.label   = [wiki:HelpPlatform Platform]
platform.options = |Intel P4|Intel XEON|AMD Athlon 64|Other

Attached patch contains an implementation for the proposal.

Attachments (5)

patch-customlabelwiki-r1049.diff (4.8 KB ) - added by pkou <pkou at ua.fm> 15 years ago.
Patch for the changes
ticket-custom-field-label-with-wiki-syntax-r2678.patch (996 bytes ) - added by Markus Tacker <m@…> 14 years ago.
ticket-custom-field-label-with-wiki-syntax-r2894.patch (1.0 KB ) - added by Markus Tacker <m@…> 14 years ago.
Updated patch for r2894
ticket-custom-field-label-with-wiki-syntax-r3931.patch (979 bytes ) - added by Markus Tacker <m@…> 13 years ago.
Updated patch for r3931
ticket-custom-field-label-with-wiki-syntax-r4458.patch (1.2 KB ) - added by Tim Hatch <trac@…> 13 years ago.
Updated patch for r4458

Download all attachments as: .zip

Change History (21)

by pkou <pkou at ua.fm>, 15 years ago

Patch for the changes

comment:1 by pkou at ua.fm, 14 years ago

Thank to refactoring in Trac 0.9, updated patch is the following:

  • trac/ticket/api.py

     
    2121
    2222from trac import perm, util
    2323from trac.core import *
     24from trac.wiki import wiki_to_oneliner
    2425
    2526
    2627class TicketSystem(Component):
     
    107108                'name': name,
    108109                'type': self.config.get('ticket-custom', name),
    109110                'order': int(self.config.get('ticket-custom', name + '.order', '0')),
    110                 'label': self.config.get('ticket-custom', name + '.label', ''),
     111                'label': wiki_to_oneliner(self.config.get('ticket-custom', name + '.label', ''), self.env, self.env.get_db_cnx()),
    111112                'value': self.config.get('ticket-custom', name + '.value', '')
    112113            }
    113114            if field['type'] == 'select' or field['type'] == 'radio':

It is easy :)

Last edited 2 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Markus Tacker <m@…>, 14 years ago

Cc: m@… added

This is the patch against [2678]. Why hasn't this been implemented yet?

Index: trac/ticket/api.py
===================================================================
--- trac/ticket/api.py  (revision 2678)
+++ trac/ticket/api.py  (working copy)
@@ -18,6 +18,7 @@
 from trac.core import *
 from trac.perm import IPermissionRequestor
 from trac.wiki import IWikiSyntaxProvider
+from trac.wiki import wiki_to_oneliner
 from trac.Search import ISearchSource, query_to_sql, shorten_result


@@ -108,7 +109,7 @@
                 'name': name,
                 'type': self.config.get('ticket-custom', name),
                 'order': int(self.config.get('ticket-custom', name + '.order', '0')),
-                'label': self.config.get('ticket-custom', name + '.label', ''),
+                'label': wiki_to_oneliner(self.config.get('ticket-custom', name + '.label', ''), self.env, self.env.get_db_cnx()),
                 'value': self.config.get('ticket-custom', name + '.value', '')
             }
             if field['type'] == 'select' or field['type'] == 'radio':
Version 0, edited 14 years ago by Markus Tacker <m@…> (next)

by Markus Tacker <m@…>, 14 years ago

comment:3 by Christian Boos, 14 years ago

Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

Any objection?

by Markus Tacker <m@…>, 14 years ago

Updated patch for r2894

comment:4 by anonymous, 14 years ago

Cc: shishz@… added

comment:5 by Christian Boos, 14 years ago

Keywords: workflow added

For info, that's currently done in the WorkFlow branch.

comment:6 by Christian Boos, 14 years ago

Milestone: 0.100.11

comment:7 by Alec Thomas, 14 years ago

Owner: changed from Christian Boos to Alec Thomas
Status: assignednew

I'll close this when WorkFlow is merged in 0.11.

comment:8 by Alec Thomas, 14 years ago

Status: newassigned

by Markus Tacker <m@…>, 13 years ago

Updated patch for r3931

comment:9 by sid, 13 years ago

#899 proposes a different approach to the same problem.

comment:10 by Markus Tacker <m@…>, 13 years ago

Can anyone provide a patch for r4458? I failed.

by Tim Hatch <trac@…>, 13 years ago

Updated patch for r4458

comment:11 by Christian Boos, 12 years ago

Milestone: 0.11.10.12

See also #6248.

comment:12 by Remy Blank, 11 years ago

I wanted to tackle this yesterday evening, but it is a lot trickier than it looks. Field labels are not only used on the ticket page, but also in the custom query page, in the query form headers and controls, and in the result table header. Some of these locations can manage HTML, and others require text only.

So this functionality actually requires the hypothetical wiki_to_text function I have seen mentioned in #1502 and on trac-dev.

comment:13 by Remy Blank, 9 years ago

Milestone: next-major-0.1Xunscheduled

comment:14 by Ryan J Ollos, 5 years ago

Owner: Alec Thomas removed
Status: assignednew

comment:15 by figaro, 4 years ago

Keywords: patch added

comment:16 by Ryan J Ollos, 2 years ago

Keywords: custom fields added; patch workflow removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.