wiki:CondFieldsGenshiPlugin

Conditionally display fields based on ticket type

Description

This plugin allows you to hide or show fields when creating or viewing a ticket, depending on the ticket type. Only the presentation changes, not the contents of the ticket.

This plugin is derived from the CondFieldsPlugin, with the difference that it is completely based on Genshi instead of using Javascript. Moreover, you can select whether selected fields are hidden or shown by default.

This plugin is standalone; the patch blackmagic-conditionalfields.patch in #2486 did not match with newer releases of Trac 0.11.

Some problems reported about the more powerful DynamicFieldsPlugin (bad scaling for many fields, malfunction if fields are internally sorted, clearing value of hidden fields) should not occur here.

It should be easy to extend this plugin, eg for dependence on parameters other than ticket type.

The plugin was tested under Trac 0.11 and 0.12.

Bugs/Feature Requests

Existing bugs and feature requests for CondFieldsGenshiPlugin are here.

If you have any issues, create a new ticket.

defect

3 / 3

enhancement

0 / 1

Download

Download the zipped source from here.

Source

You can check out CondFieldsGenshiPlugin from here using Subversion, or browse the source with Trac.

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

Configuration

First, configure your trac.ini file as in this example:

[components]
condfieldsgenshi.* = enabled

...

[condfieldsgenshi]
tweaks = field1, field2
default = disable
field1.type_cond = defect
field2.type_cond = task
field3.type_cond = !enhancement, task

Effect:

Now field1 will be shown only if the ticket type is defect, field2 only if the ticket type is task, and field3 only if the ticket type is neither "task" nor "enhancement".

The entry:

default = disabled

means that the field listed under tweaks are not shown by default.

The default value is default = enabled.

To disable/enable a field independent of the ticket type, simply write a line like:

field1.type_cond =

When you change the ticket type, you must submit a preview before you can see the effect of condfieldsgenshi.

Bug fix done for type field

When the ticket type is given as an URL parameter only:

.../newticket?type=task

and the ticket type field is disabled, this plugin works nevertheless, in contrast to the CondFieldsPlugin.

The type field label is extended by (Fixed) in this case now.

Recent Changes

17702 by rjollos on 2020-04-29 02:08:48
CondFieldsGenshiPlugin 0.3dev: Don't lower before comparison

Fixes #13756.

17121 by rjollos on 2018-04-13 09:59:38

CondFieldsGenshiPlugin 0.3dev: Fix multiple defects

  • Ticket type selection did not work for previews
  • Use empty value rather than None to indicate "all values"
  • Use enabled and disabled values for field default
13364 by rjollos on 2013-08-26 12:22:32
Moved license text to COPYING file. Fixes #11282.
(more)

Author/Contributors

Author: Reinhard
Maintainer: Reinhard Wobst
Contributors:

Last modified 7 years ago Last modified on Apr 13, 2018, 9:59:49 AM

Attachments (1)

Download all attachments as: .zip