Changes between Version 6 and Version 7 of ArbitraryProjectPropertiesPatch


Ignore:
Timestamp:
Dec 1, 2016, 8:41:50 AM (7 years ago)
Author:
figaro
Comment:

Moved example to functional description

Legend:

Unmodified
Added
Removed
Modified
  • ArbitraryProjectPropertiesPatch

    v6 v7  
    55== Description
    66
    7 With this patch you can specify a `[project_info]` stanza in your `trac.ini` file, and everything in that stanza will be passed to your project listing template as key-value pairs under the dictionary `project.info`.
     7With this patch you can specify key-value pairs that will be passed on to your project listing template. To achieve this, it requires a new `[project_info]` stanza in your `trac.ini` file that acts as a dictionary of the key-value pairs.
     8
     9Imagine you have trac.ini's for each project with data like:
     10{{{#!ini
     11[project_info]
     12short_name = my_project
     13status = active
     14order = 3
     15}}}
     16
     17You can then iterate over them in your project listing template like:
     18{{{
     19<div class='incubator'>
     20    <h3>Incubator</h3>
     21    <div py:for='project in projects' py:if='project.info.get("status") == "incubator"' class='project'>
     22        <a class='name' href='${project.href}'>${project.name}</a> -
     23        <span class='description'>${project.description}</span>
     24    </div>
     25</div>
     26}}}
    827
    928You can do this inside each project too, with the ArbitraryOptionsPlugin.
     
    2746You can check out ArbitraryProjectPropertiesPatch from [/svn/arbitraryprojectpropertiespatch here] using Subversion, or [source:arbitraryprojectpropertiespatch browse the source] with Trac.
    2847
    29 == Example
     48== Installation
    3049
    31 Imagine you have trac.ini's for each project with data like:
    32 {{{#!ini
    33 [project_info]
    34 short_name = my_project
    35 status = active
    36 order = 3
    37 }}}
    38 
    39 You can then iterate over them in your project listing template like:
    40 {{{
    41 &lt;div class='incubator'&gt;
    42     &lt;h3&gt;Incubator&lt;/h3&gt;
    43     &lt;div py:for='project in projects' py:if='project.info.get(&#34;status&#34;) == &#34;incubator&#34;' class='project'&gt;
    44         &lt;a class='name' href='${project.href}'&gt;${project.name}&lt;/a&gt; -
    45         &lt;span class='description'&gt;${project.description}&lt;/span&gt;
    46     &lt;/div&gt;
    47 &lt;/div&gt;
    48 }}}
     50General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page.
    4951
    5052== Recent Changes