| 1 | = Arbitrary Options Plugin = |
| 2 | |
| 3 | == Description == |
| 4 | |
| 5 | Pass arbitrary options from conf.ini's to templates in Trac. |
| 6 | |
| 7 | You 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 | |
| 9 | You 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 | |
| 15 | Existing bugs and feature requests for ArbitraryOptionsPlugin are |
| 16 | [report:9?COMPONENT=ArbitraryOptionsPlugin here]. |
| 17 | |
| 18 | If you have any issues, create a |
| 19 | [http://trac-hacks.org/newticket?component=ArbitraryOptionsPlugin&owner=david new ticket]. |
| 20 | |
| 21 | == Download == |
| 22 | |
| 23 | Download the zipped source from [download:arbitraryoptionsplugin here]. |
| 24 | |
| 25 | == Source == |
| 26 | |
| 27 | You 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 | |
| 31 | If your .ini had this: |
| 32 | |
| 33 | {{{ |
| 34 | [project_info] |
| 35 | short_name = my_project |
| 36 | status = active |
| 37 | order = 3 |
| 38 | }}} |
| 39 | |
| 40 | You could access it in your Trac's Genshi templates like this: |
| 41 | |
| 42 | {{{ |
| 43 | Short name is ${project_info.get('short_name')}. Status is ${project_info.get('status')}. Order is ${project_info.get('order')}. |
| 44 | }}} |
| 45 | |
| 46 | You 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 | |
| 53 | See 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:''' |