Changes between Version 47 and Version 48 of DynamicFieldsPlugin
- Timestamp:
- Aug 1, 2016, 9:23:45 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DynamicFieldsPlugin
v47 v48 8 8 9 9 Key features: 10 * Hide a field based on another field's value 11 * Default a field's value per user preference 12 * Clear a field's value when another field's value changes 13 * Copy one field's value to another field 14 * Validate a field's value 15 * Set a field's value based on another field's value 10 * Hide a field based on another field's value. 11 * Default a field's value per user preference. 12 * Clear a field's value when another field's value changes. 13 * Copy one field's value to another field. 14 * Validate a field's value. 15 * Set a field's value based on another field's value. 16 16 17 17 == Bugs/Feature Requests … … 38 38 39 39 1. Install the plugin after downloading and unzipping: 40 41 42 43 44 45 46 40 {{{#!sh 41 cd dynamicfieldsplugin/0.11 42 sudo python setup.py bdist_egg 43 sudo cp dist/TracDynamicFields*.egg /your/trac/location/plugins/ 44 }}} 45 46 See TracPlugins for more installation details and options. You will likely need to restart Trac's web server after installation. 47 47 48 48 2. Enable the plugin: 49 50 51 52 53 54 49 {{{#!ini 50 [components] 51 dynfields.* = enabled 52 }}} 53 54 You can alternatively use the Trac Web Admin GUI to enable any or all rules. 55 55 56 56 See the examples section [wiki:DynamicFieldsPlugin#Examples below] for how to specify rules. … … 58 58 == Examples 59 59 60 This plugin currently includes six rules. Each rule is specified by modifying the {{{[ticket-custom]}}} section of {{{trac.ini}}}. Below are several examples to motivate usingeach rule.61 62 === =Hide rule60 This plugin currently includes six rules. Each rule is specified by modifying the {{{[ticket-custom]}}} section of your {{{trac.ini}}} file. Below are several examples to each rule. 61 62 === Hide rule 63 63 64 64 Let's say that your team only specifies effort for enhancements, but not for defects or other ticket types. This rule shows a custom {{{effort}}} field only when the {{{type}}} field's value is ''enhancement'': … … 100 100 }}} 101 101 102 The default is that hidden fields are '' not'' enabled to be shown, ie {{{link_to_show}}} defaults to ''false''. The "Show hidden fields" link is only shown when there are hidden fields and at least one of them is enabled to be shown.103 104 === =Clear rule102 The default is that hidden fields are '''not''' enabled to be shown, ie {{{link_to_show}}} defaults to ''false''. The "Show hidden fields" link is only shown when there are hidden fields and at least one of them is enabled to be shown. 103 104 === Clear rule 105 105 106 106 In the version/milestone example above, if the {{{milestone}}} changes then we want the {{{version}}} field to be cleared: … … 112 112 Note that 'clearing' a select field will actually reset it to its default value if no 'empty' option is available. 113 113 114 === =Copy rule114 === Copy rule 115 115 116 116 Let's say your workflow includes reassigning a ticket's {{{owner}}} to someone else for review or verification but maintain the person responsible for the work in a custom {{{captain}}} field. Initially the {{{captain}}} should be set to the {{{owner}}}, so to reduce data entry in making this so: … … 120 120 }}} 121 121 122 The default copy behavior is to not overwrite a value if one already exists. 122 The default copy behavior is to not overwrite a value if one already exists. To always copy the value, add {{{(overwrite)}}} as follows: 123 123 {{{#!ini 124 124 [ticket-custom] … … 126 126 }}} 127 127 128 === =Default rule128 === Default rule 129 129 130 130 Let's say your QA team usually creates defect tickets and your product managers usually create enhancement tickets. Here's how to allow each user to set the default value for the ticket {{{type}}}: … … 145 145 The above example introduces the plugin's user preference facility described below. 146 146 147 === =Validate rule147 === Validate rule 148 148 149 149 Some fields may be required, ie can't be empty, or must not contain some specific values. For example: … … 165 165 }}} 166 166 167 The above example is for the [wiki:CodeReviewerPlugin CodeReviewer plugin] when using its ticket reference macro to prevent a ticket moving a custom {{{phase}}} field past "codereview" if there are either pending reviews or the last changeset has not passed review. The value is a jQuery selector -if it returns one or more items then the validation is applied, else it's skipped. The {{{.1}}} and {{{.2}}} suffix for the option keys are to group the {{{invalid_if}}} and {{{invalid_when}}} parts together.168 169 === =Set rule170 171 When a developer starts working on a ticket, you may want to make sure she sets the milestone accordingly:167 The above example is for the [wiki:CodeReviewerPlugin CodeReviewer plugin] when using its ticket reference macro to prevent a ticket moving a custom {{{phase}}} field past "codereview" if there are either pending reviews or the last changeset has not passed review. The value is a jQuery selector and if it returns one or more items then the validation is applied, else it's skipped. The {{{.1}}} and {{{.2}}} suffix for the option keys are to group the {{{invalid_if}}} and {{{invalid_when}}} parts together. 168 169 === Set rule 170 171 When a developer starts working on a ticket, you may want to make sure (s)he sets the milestone accordingly: 172 172 {{{#!ini 173 173 [ticket-custom] … … 175 175 }}} 176 176 177 When the {{{phase}}} field changes to either ''implementation'', ''verifying'', or ''releasing'', then the {{{milestone}}} will get set to ''milestone3''. 177 When the {{{phase}}} field changes to either ''implementation'', ''verifying'', or ''releasing'', then the {{{milestone}}} will get set to ''milestone3''. To avoid needing to update the current milestone's value in the rule, you can alternatively use the special ''"!"'' value which specifies to set the field to the first non-empty value: 178 178 {{{#!ini 179 179 milestone.set_to_!_when_phase = implementation|verifying|releasing … … 190 190 }}} 191 191 192 Learn more about user preferences below. The default set behavior is to not overwrite a value if one already exists.To always set the value, add {{{(overwrite)}}} as follows:192 Learn more about user preferences below. The default set behavior is to not overwrite a value if one already exists. To always set the value, add {{{(overwrite)}}} as follows: 193 193 {{{#!ini 194 194 [ticket-custom] … … 226 226 But English message texts are still the (POSIX) default. If this isn't your preferred language, you can 227 227 1. check if it's already available from the [TracPluginTranslation Trac plugin l10n project] at [https://www.transifex.net/projects/p/Trac_Plugin-L10N/resource/dynfields Transifex] or 228 2. do it yourself: see the [trac:wiki:CookBook/PluginL10N#Dotranslatorswork l10n cookbook page for Trac plugins] for more details.228 1. do it yourself: see the [trac:wiki:CookBook/PluginL10N#Dotranslatorswork l10n cookbook page for Trac plugins] for more details. 229 229 230 230 Contributing your translation is highly appreciated!