ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Plugin Enumerations

Added by Denise Mauldin at 2011-05-12 07:15 pm

Hey all,

I'm writing a plugin to track our specific kinds of data in ChiliProject and I wanted to add several enumerations to drop down lists for the plugin. For example, I want to have a status dropdown with 5-6 different status choices. Given that I'm a newbie Rails/Ruby programmer, what should I do to learn about how to do this? Is there a good example plugin that does this that I could learn from? Is there something more specific in the docs pages other than the [[ http://www.redmine.org/projects/redmine/wiki/RedmineCustomFields ]] documentation?


Replies (1)

RE: Plugin Enumerations - Added by Eric Davis at 2011-05-12 11:29 pm

You have three options:

  1. build a separate model, controller, view for each of the different data types. This will give you the most control. I use this when the different data/enumerations have logic or need multiple associations
  2. use custom fields. They are restrictive and difficult to use programatically but can work. I use these when the data can stand on it's own and the plugin is just querying it (e.g. custom field on Issue for "department" with a plugin that just filters based on that field)
  3. use the actual Enumerations model. This is provided by ChiliProject and there is a full administration panel for them already (create, edit, delete, order). If you are tracking a single text string or a position, these work really good.

For an example of using the Enumerations model; in my contracts plugin I allow admins to enter billing terms. These are only simple data values that a user can select so Enumerations fit perfectly. All I had to do was to create a subclass of Enumeration and provide a few methods for it code.

Hope this helps

Eric Davis

(1-1/1)