Edgewall Software
Modify

Ticket #925 (assigned enhancement)

Opened 7 years ago

Last modified 20 months ago

[PATCH] Allow wiki syntax in labels for custom fields

Reported by: pkou <pkou at ua.fm> Owned by: athomas
Priority: normal Milestone: unscheduled
Component: ticket system Version: devel
Severity: normal Keywords: workflow
Cc: m@…, shishz@…
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

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

Download all attachments as: .zip

Change History

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

Patch for the changes

comment:1 Changed 7 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 :)

comment:2 Changed 6 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 6 years ago by Markus Tacker <m@…>

comment:3 Changed 6 years ago by cboos

  • Milestone set to 0.10
  • Owner changed from jonas to cboos
  • Status changed from new to assigned

Any objection?

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

Updated patch for r2894

comment:4 Changed 6 years ago by anonymous

  • Cc shishz@… added

comment:5 Changed 6 years ago by cboos

  • Keywords workflow added

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

comment:6 Changed 6 years ago by cboos

  • Milestone changed from 0.10 to 0.11

comment:7 Changed 6 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.

comment:8 Changed 6 years ago by athomas

  • Status changed from new to assigned

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

Updated patch for r3931

comment:9 Changed 5 years ago by sid

#899 proposes a different approach to the same problem.

comment:10 Changed 5 years ago by Markus Tacker <m@…>

Can anyone provide a patch for r4458?
I failed.

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

Updated patch for r4458

comment:11 Changed 4 years ago by cboos

  • Milestone changed from 0.11.1 to 0.12

See also #6248.

comment:12 Changed 3 years 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.

comment:13 Changed 20 months ago by rblank

  • Milestone changed from next-major-0.1X to unscheduled
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from athomas. Next status will be 'new'
Author


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

 
Note: See TracTickets for help on using tickets.