Changes between Initial Version and Version 1 of ArbitraryOptionsPlugin


Ignore:
Timestamp:
Feb 3, 2010, 6:33:58 PM (14 years ago)
Author:
David
Comment:

New hack ArbitraryOptionsPlugin, created by david

Legend:

Unmodified
Added
Removed
Modified
  • ArbitraryOptionsPlugin

    v1 v1  
     1= Arbitrary Options Plugin =
     2
     3== Description ==
     4
     5Pass arbitrary options from conf.ini's to templates in Trac.
     6
     7You put whatever options you'd like in a [project_info] stanza inside your trac's .ini file. These are passed to the template as key-value pairs inside the dictionary 'project_info'.
     8
     9You can also access data for other projects in your trac env under the list 'projects'. That list will have a dictionary with keys 'name', 'description', 'href', and 'info', where the first three are the same as in a project list, and the 'info' is the dictionary of arbitrary options you've passed for that project.
     10
     11
     12
     13== Bugs/Feature Requests ==
     14
     15Existing bugs and feature requests for ArbitraryOptionsPlugin are
     16[report:9?COMPONENT=ArbitraryOptionsPlugin here].
     17
     18If you have any issues, create a
     19[http://trac-hacks.org/newticket?component=ArbitraryOptionsPlugin&owner=david new ticket].
     20
     21== Download ==
     22
     23Download the zipped source from [download:arbitraryoptionsplugin here].
     24
     25== Source ==
     26
     27You can check out ArbitraryOptionsPlugin from [http://trac-hacks.org/svn/arbitraryoptionsplugin here] using Subversion, or [source:arbitraryoptionsplugin browse the source] with Trac.
     28
     29== Example ==
     30
     31If your .ini had this:
     32
     33{{{
     34[project_info]
     35short_name = my_project
     36status = active
     37order = 3
     38}}}
     39
     40You could access it in your Trac's Genshi templates like this:
     41
     42{{{
     43Short name is ${project_info.get('short_name')}. Status is ${project_info.get('status')}.  Order is ${project_info.get('order')}.
     44}}}
     45
     46You could iterate over your whole projects list like this:
     47{{{
     48<li py:for='proj in projects' py:if='proj.name != project.name and proj.info.get("status") == "primary"'>
     49    <a href='/${proj.href}'>${proj.name}</a>
     50</li>
     51}}}
     52
     53See also http://www.siafoo.net/snippet/276 for information.
     54
     55
     56== Recent Changes ==
     57
     58[[ChangeLog(arbitraryoptionsplugin, 3)]]
     59
     60== Author/Contributors ==
     61
     62'''Author:''' [wiki:david] [[BR]]
     63'''Maintainer:''' [wiki:david] [[BR]]
     64'''Contributors:'''