Changes between Version 5 and Version 6 of OhlohWidgetsMacroPlugin


Ignore:
Timestamp:
Mar 10, 2015, 12:20:01 PM (9 years ago)
Author:
figaro
Comment:

Added installation and configuration steps

Legend:

Unmodified
Added
Removed
Modified
  • OhlohWidgetsMacroPlugin

    v5 v6  
    99Also this macro has a special API so you can modify any Ohloh widget so it blends in better with your layout.
    1010
     11== Installation
     12
     13Prerequisites:
     14 * Python 2.3-2.6
     15 * pypi:pycerberus
     16 * Trac 0.11+
     17
     18Enable the macro in your `trac.ini`:
     19
     20{{{#!ini
     21[components]
     22ohloh_widgets.macro = enabled
     23# if you want to have better display of certain macros, enable also widget modificators:
     24ohloh_widgets.* = enabled
     25}}}
     26
     27== Configuration
     28
     29Some Ohloh widgets do not look nice on a Trac page, because some elements do not respect Trac's layout, eg they use different colors for links. This macro already includes some modifiers which can change the appearance of some Ohloh macros with Javascript (jQuery) and CSS, but you can easily add your own by writing a small plugin which implements this interface:
     30
     31{{{#!python
     32# This class is in ohloh_widgets.api
     33class IOhlohWidgetModifier(Interface):
     34    def widget_name(self):
     35        """Return the name of the widget which this modifier can modify.
     36       
     37        The widget name is the name of the JS file (e.g. 'project_factoids.js')
     38        without the '.js' suffix (=> 'project_factoids').
     39        """
     40   
     41    def widget_fix(self):
     42        """Return a Genshi tag which is inserted directly after the widget's script
     43        tag. Use this to add custom CSS/Javascript which whips the widget into shape
     44        (again)."""
     45}}}
     46
    1147== Examples
    1248
    1349Display a single widget by specifying your project id and the widget name, ie the Javascript file name without the '.js' suffix:
     50
    1451{{{
    1552[[OhlohWidget(483602, project_basic_stats)]]
     
    1754
    1855Also you can display a group of widgets together:
     56
    1957{{{
    2058[[OhlohWidgetGroup(483602, project_basic_stats, project_factoids, project_users?style=green)]]
    2159}}}
     60
    2261This has the advantage that all widgets are grouped in a div so you can style it easily.
    2362
     
    2766
    2867Check the '''[http://www.schwarz.eu/opensource/projects/ohloh_widgets_macro/ online demo]''' to see the macro in action.
    29 
    3068
    3169== Source