wiki:HideChangesPlugin

Version 3 (modified by Rob Guttman, 13 years ago) (diff)

--

Hide ticket changes based on configurable rules

Notice: This plugin is unmaintained and available for adoption.

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 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 TracPlugins for more installation details and options. You'll likely need to restart Trac's web server after installation.

  1. Enable the plugin:
    [components]
    hidechanges.* = enabled
    

You can alternatively use the Trac Web Admin GUI to enable any or all rules.

  1. Create rules in the [hidechanges] section of trac.ini for which changes to hide. See examples below for details and ideas.

Bugs/Feature Requests

Existing bugs and feature requests for HideChangesPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from [download:hidechangesplugin here].

Source

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

Example

You define rules using the rule.<name> option in the [hidechanges] section of trac.ini as freeform JavaScript/jQuery 1.8.7 code. Each rule <name> 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

14031 by rjollos on 2014-07-25 11:34:10
Changed license to 3-Clause BSD with permission of author. Refs #11832.
13991 by rjollos on 2014-06-22 09:47:31
1.0.1: Fix indentation and cleanup whitespace using reindent.py
9735 by robguttman on 2011-01-04 17:10:33
removing 0.12 branch in favor of trunk.
(more)

Author/Contributors

Author: robguttman
Maintainer: robguttman
Contributors: