myexperiment-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Myexperiment-discuss] Get credits and tags


From: Jiten Bhagat
Subject: Re: [Myexperiment-discuss] Get credits and tags
Date: Thu, 06 Nov 2008 17:45:08 +0000
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)

Hi Tony,

To get a list (ie: array) of creditors name (I'm assuming you don't want *usernames* and you want just the names of users who have been credited, not groups):

credits_names = workflow.creditors.map{|c| c.creditor.name if c.creditor_type == 'User'}.compact

The reason for the "c.creditor_type == 'User'" and the ".compact" is to get rid of groups in the list. If you want groups as well then do:

credits_names = workflow.creditors.map{|c| c.creditor.contributor_label}


For tags do:

tags = workflow.tags.collect{|t| t.name}


We've been putting together more information about the myExperiment codebase here: http://wiki.myexperiment.org/index.php/Developer:Docs. You could take a look there, as a start and if you have detailed questions let us know.

Cheers,
Jits


Linde, A.E. wrote:
Sorry to bother everyone again, but I need to get just the names of creditors and tags against each workflow. I’ve copied the stuff from _table.rhtml and got:

<% unless (creditors = workflow.creditors).empty? %> cn_<%= workflow.id %> = "<% creditors.each do |c| %><%= contributor(c.creditor_id, c.creditor_type) %><% end %>"; <% else %> cn_<%= workflow.id %> = ""; <% end %>

<% unless (tags = workflow.tags).empty? %> ta_<%= workflow.id %> = "<%= tag_cloud_from_collection tags, true %>"; <% else %> ta_<%= workflow.id %> = ""; <% end %> But of course contributor and tag_cloud... give full html stuff. I have tried to figure out where to get this information by searching the code for relevant bits but have failed. (Maybe now I understand a *little* bit more I could do with another explanation of how the myExperiment rails app is structured and works.)

In the meantime, could I ask just for the creditor names and tag names to plug into the above code?

Thanks,
Tony.
------------------------------------------------------------------------

_______________________________________________
Myexperiment-discuss mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/myexperiment-discuss





reply via email to

[Prev in Thread] Current Thread [Next in Thread]