[[PageOutline(2-5,Contents,pullout)]] = Hide ticket changes based on configurable rules = == Description == Tickets can get noisy with lots of changes. This plugin hides a configurable set of changes to reduce this clutter. A button toggles between showing and hiding the changes. See [wiki:HideChangesPlugin#Examples examples below]. '''SECURITY WARNING! ''' This plugin processes freeform !JavaScript/jQuery code from the {{{trac.ini}}} file. If this can be a security concern in your Trac deployment, please do not use this plugin. == Configuration == 1. Install the plugin (after downloading and unzipping): {{{ cd hidechangesplugin/trunk sudo python setup.py bdist_egg sudo cp dist/TracHideChanges*.egg /your/trac/location/plugins/ }}} See [http://trac.edgewall.org/wiki/TracPlugins TracPlugins] for more installation details and options. You'll likely need to restart Trac's web server after installation. 2. Enable the plugin: {{{ [components] hidechanges.* = enabled }}} You can alternatively use the Trac Web Admin GUI to enable any or all rules. 3. Create rules in the {{{[hidechanges]}}} section of {{{trac.ini}}} for which changes to hide. See [wiki:HideChangesPlugin#Examples examples below] for details and ideas. == Bugs/Feature Requests == Existing bugs and feature requests for HideChangesPlugin are [report:9?COMPONENT=HideChangesPlugin here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=HideChangesPlugin&owner=robguttman new ticket]. == Download == Download the zipped source from [download:hidechangesplugin here]. == Source == You can check out HideChangesPlugin from [http://trac-hacks.org/svn/hidechangesplugin here] using Subversion, or [source:hidechangesplugin browse the source] with Trac. == Example == You define rules using the {{{rule.}}} option in the {{{[hidechanges]}}} section of {{{trac.ini}}} as freeform !JavaScript/jQuery 1.8.7 code. Each rule {{{}}} must be unique. Each rule (code) must evaluate to either {{{true}}} or {{{false}}}. If {{{true}}}, the change will be hidden. A {{{changediv}}} jQuery object is available to use within each rule. An example can be helpful to explain this more concretely... === Hide commentless changes === The most common type of changes to want to hide are commentless changes - e.g., when just a field changes without any comment. Here's how you would configure this rule in {{{trac.ini}}}: {{{ [hidechanges] rule.commentless = !changediv.find('div.comment').children().length show_button_name = Show commentless changes hide_button_name = Hide commentless changes }}} The above rule is named {{{commentless}}}. It checks the change div's comment div for any children. If no children are found (length = {{{0}}}), that means the change is commentless. Since the rule needs to evaluate to {{{true}}} to hide a change, we negate the result with a {{{!}}}. In this example, we also changed the default button names to make it clear what type of comments are hidden. The button's name changes as the changes are shown or hidden. === Hide changeset changes === To hide changeset changes that are in the Trac 0.12 wiki syntax: {{{ [hidechanges] rule.changeset = changediv.find('p a.changeset').children().length }}} This {{{changeset}}} rule checks for an href node with the {{changeset}}} class - this is the wiki syntax for changesets introduced in Trac 0.12 (I believe). If found, hide the change! You can combine both/all rules in the {{{[hidechanges]}}} section of the {{{trac.ini}}} file as long as the names are unique. You should take care in naming the buttons accordingly as one set of buttons apply to all hidden changes. == Recent Changes == [[ChangeLog(hidechangesplugin, 3)]] == Author/Contributors == '''Author:''' [wiki:robguttman] [[BR]] '''Maintainer:''' [wiki:robguttman] [[BR]] '''Contributors:'''