Edgewall Software

Ticket #925 (assigned enhancement)

Opened 4 years ago

Last modified 3 months ago

[PATCH] Allow wiki syntax in labels for custom fields

Reported by: pkou <pkou at ua.fm> Owned by: athomas
Priority: normal Milestone: 0.13
Component: ticket system Version: devel
Severity: normal Keywords: workflow
Cc: m@…, shishz@…

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

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

Change History

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

Patch for the changes

Changed 3 years ago by pkou at ua.fm

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

Index: trac/ticket/api.py
===================================================================
--- trac/ticket/api.py	(revision 1850)
+++ trac/ticket/api.py	(working copy)
@@ -21,6 +21,7 @@
 
 from trac import perm, util
 from trac.core import *
+from trac.wiki import wiki_to_oneliner
 
 
 class TicketSystem(Component):
@@ -107,7 +108,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':

It is easy :)

Changed 3 years ago by Markus Tacker <m@…>

  • 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':

Changed 3 years ago by Markus Tacker <m@…>

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • milestone set to 0.10

Any objection?

Changed 3 years ago by Markus Tacker <m@…>

Updated patch for r2894

Changed 3 years ago by anonymous

  • cc shishz@… added

Changed 3 years ago by cboos

  • keywords workflow added

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

Changed 3 years ago by cboos

  • milestone changed from 0.10 to 0.11

Changed 3 years ago by athomas

  • owner changed from cboos to athomas
  • status changed from assigned to new

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

Changed 3 years ago by athomas

  • status changed from new to assigned

Changed 2 years ago by Markus Tacker <m@…>

Updated patch for r3931

Changed 2 years ago by sid

#899 proposes a different approach to the same problem.

Changed 2 years ago by Markus Tacker <m@…>

Can anyone provide a patch for r4458? I failed.

Changed 2 years ago by Tim Hatch <trac@…>

Updated patch for r4458

Changed 13 months ago by cboos

  • milestone changed from 0.11.1 to 0.12

See also #6248.

Changed 3 months ago by rblank

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.

Add/Change #925 ([PATCH] Allow wiki syntax in labels for custom fields)

Author



Change Properties
<Author field>
Action
as assigned
as The resolution will be set. Next status will be 'closed'
to The owner will change from athomas. Next status will be 'new'
 
Note: See TracTickets for help on using tickets.