myexperiment-discuss
[Top][All Lists]
Advanced

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

[Myexperiment-discuss] Get workflow and related


From: Linde, A.E.
Subject: [Myexperiment-discuss] Get workflow and related
Date: Fri, 7 Nov 2008 14:21:40 +0000

Just what I needed once again, Jits. Thank you.

And good to see the developer docs – I’ll look them over in more detail next week – with luck, all my pestering will help you with those.

Wth your help I’ve now got my shadowbox displaying everything from the workflow (prototype.js’s template feature is cool). When the user adds their own annotations and clicks the button to post the claim to the triplestore, I’ll want to access the whole of the workflow and related entities from the proxy controller, so:

  wf = workflows.get(id=99)
  title = wf.title
  creds = wf.creditors
    and so on to get creds[n].name, creds[n].id etc

and so on. I think all I need is the command to get the workflow object and from there I can use the stuff in the /views/workflows to get the rest – yes?

Cheers,
Tony.



On 06/11/2008 12:45, "Jiten Bhagat" <address@hidden> wrote:
 
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
>  




--
Tony Linde
Project Manager
Department of Physics & Astronomy
University of Leicester

reply via email to

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