wiki:TracTweakUiPlugin

Version 7 (modified by Russ Tyndall, 14 years ago) (diff)

added a note about the related AddStaticResourcesPlugin that I just created

Trac Tweak UI

SEE:ZoomQuiet ~ Collection KSPEG Trac hacking

Description

  • Its purpose is to implement a javascript deployment platform, which enable trac administrators to easy tweak trac pages by simply using javascript.
  • It can apply different javascripts to different pages by matching regular expression.
  • Support trac web admin

Bugs/Feature Requests

Existing bugs and feature requests for TracTweakUiPlugin are here.

If you have any issues, create a new ticket.

Download

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

Source

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

Configuration

  1. Uninstall Trac Tweak UI if you have installed before.
  1. Change to the directory containning setup.py.
  1. If you want to install this plugin globally, that will install this plugin to the python path:
    • python setup.py install
  1. If you want to install this plugin to trac instance only:
    • python setup.py bdist_egg
    • copy the generated egg file to the trac instance's plugin directory
      cp dist/*.egg /srv/trac/env/plugins
      
  1. Config trac.ini:
    [components]
    tractweakui.* = enabled
    
  1. Add following directory structure to trac environment's htdocs directory(using editcc as example):
    htdocs/tractweakui/
    

Or you can simply copy the htdocs/tractweakui/ in source to trac environment's htdocs directory.

Example

Admin Trac Tweak UI with addon javascript plugins

  1. Enter trac's Web Admin, select TracTweakUI Admin
  2. Add url path(regular expression): /newticket
  3. Select /newticket, then select filter editcc
  4. Click Load Default, and edit filter javascript, then Save
  5. Now click New Ticket to test the editcc javascript plugin.
    • Screenshot of Admin
    • Screenshot of editcc

Admin Trac Tweak UI with any other javascript plugins

  1. take autocomplete for instance
  1. Prepare autocomplete directory in trac environment
    mkdir /path/to/trac/environment/htdocs/tractweakui/autocomplete
    cp main.css /path/to/trac/environment/htdocs/tractweakui/autocomplete/
    cp jquery.autocomplete.css /path/to/trac/environment/htdocs/tractweakui/autocomplete/
    cp jquery.autocomplete.js /path/to/trac/environment/htdocs/tractweakui/autocomplete/
    cp jquery.bgiframe.min.js /path/to/trac/environment/htdocs/tractweakui/autocomplete/
    cp indicator.gif /path/to/trac/environment/htdocs/tractweakui/autocomplete/
    touch /path/to/trac/environment/htdocs/tractweakui/autocomplete/__template__.js
    
  1. Edit template.js (optional)
    $(document).ready(function() {
    	var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
    	$("#field-cc").autocomplete(months);
    });
    
  1. Now, you can admin and test autocomplete javascript plugins as described above.

Related Plugins

  • AddStaticResourcesPlugin - Attempting to accomplish many of the same goals in a different way. Very simple deployment and .ini configuration (no webadmin screens). Doesn't require and upgrade.

Recent Changes

17171 by rjollos on 2018-05-09 20:43:38
TracTweakUI 1.2dev: Remove need to copy templates to env htdocs dir

Refs #13428.

17170 by rjollos on 2018-05-09 19:45:46
TracTweakUI 1.2dev: Make compatible with Trac 1.2

Refs #13428.

17169 by rjollos on 2018-05-09 19:04:17
TracTweakUI 1.2dev: Branch for Trac 1.2 support
(more)

Author/Contributors

Author: richard
Contributors:

Attachments (2)

Download all attachments as: .zip