Project

General

Profile

Improving /projects with ajax-y search: are custom fields the way to go?

Added by Enrique Garcia almost 14 years ago

Some background: my client is expecting to have a big list of projects in the future. He's asked me to improve the projects page (/projects) with things like ajax-reloading depending on chosen drop-downs.

So I'm considering using custom fields (+ a plugin) for this task.

I've played around with the code in console mode. It seems this is the way to use them:

category = CustomField.find_by_name_and_type('category','ProjectCustomField')
project =  Project.find(...) # (choose one project with a category)
project.custom_value_for(category).value # returns the value of the custom field, i.e. "hardware" 
My questions are:
  • Is the code above the best way to obtain the value, or is there a simpler way?
  • It seems that the "search" applicance (provided by the Searchable module, I believe) doesn't take into account custom fields. Is there any way to make it do so? I could not find any significant plugin or patch on this regard.

Thanks a lot!


Replies (1)

RE: Improving /projects with ajax-y search: are custom fields the way to go? - Added by Felix Schäfer almost 14 years ago

At least on trunk some of the custom field types for projects can be made searchable.

As for the quickest way to get a project's custom field: Project.find(...).custom_value_for(CustomField.find...(...)).value should pretty much be it, I'm not that versed in the subject though. Maybe you could drop by #redmine on freenode and ask edavis10 if he can help.

    (1-1/1)