[Hobo Users] Custom links on items in table-plus

7 views
Skip to first unread message

Patrick Fitzgerald

unread,
Nov 21, 2009, 4:51:32 PM11/21/09
to hobo...@googlegroups.com
Sorry for posting this under:
Prototype v.1.6.1 and Hobo

Hi All,
  Scratching my head over this one.  I have created a table using:

<table-plus fields="status, created_date, updated_date, file_path_link, user" />

Which display everything in a lovely table.  The thing is, file_path_link contains text which has the location of a file on the filesystem.  I want to make this a hyper link and cannot get it to work.

For example, if the text returned by file_path_link is: 1/2/filename.jpg

How do I make that a hyper link which points to:


The idea is that clicking on the text will allow the user to download the file.

All help and suggestions welcome!

Thanks,
Patrick

Bryan Larsen

unread,
Nov 21, 2009, 5:02:18 PM11/21/09
to hobo...@googlegroups.com
Did you not get my response? Cutting and pasting...


It should be something like:

<file-path-link-view:>
<a href="http://127.0.0.1:3000/#{this.to_s}" />
<file-path-link-view:>

If 127.0.0.1:3000 is the rails server, you should use #{root_path}
instead of hardcoding in the url.

cheers,
Bryan
> --
>
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=.

Patrick Fitzgerald

unread,
Nov 21, 2009, 5:21:39 PM11/21/09
to hobo...@googlegroups.com
Hi Bryan
     I got your response just after I resent this!  I managed to get it working using your advice.  What I was missing was the magic provided by the "this" object.  Pretty basic error!

To get it to work I used a parameterized version of collection.  

In the definition for index-page in application.dryml I used:

<collection param/>

Then I created an index.dryml in the view for my controller:

<index-page>
<collection: replace>
<div>
<table-plus fields= "status, created_date, updated_date" >
<controls:>
<% if this.capture_path =~ /File not available/ %>
No file
<% else %>
<a href="#{this.file_path}" >Download file</a>
<% end %>
</controls:>
</table-plus>
</div>
</collection:>
</index-page>

The key to getting all this to work was remembering the "this" object!

I hope this helps someone else with a similar problem.  

Thanks Bryan for the push in the right direction.

Cheers,

Patrick
Reply all
Reply to author
Forward
0 new messages