A nice way to do this would be to create a rich-type called url and declare the field as a :url instead of a :string in the 'fields do' block
Here's some guidance http://cookbook.hobocentral.net/recipes/1-add-your-own-rich-type Note that this rich type would be a subclass of string which means you don't need to mess about with DelegateClass like in the recipe. Just create a subclass of String Then in the <view> tag you define, render a link Tom On 1 May 2009, at 07:24, skeemer wrote: > > Maybe this will help. I'm including the card generated. Instead of > just the text for the field website showing, I want to change it into > a link. > > <def tag="show-page" for="Location"> > <page merge title="Location"> > > <body: class="show-page location" param/> > > <content: param> > <header param="content-header"> > <h2 param="heading"><name/></h2> > > <field-names-where-true fields="" param/> > > <a action="edit" if="&can_edit?" param="edit-link">Edit > Location</a> > </header> > > <section param="content-body"> > <field-list fields="address, city, state, website, map" > param/> > </section> > </content:> > > </page> > </def> > > I would assume that I have to change the field list and add my own > link for that field, but I'm not sure what tags to use to drill down > like that or if that is the right solution. > > Leo > > On Apr 28, 12:43 pm, Bryan Larsen <[email protected]> wrote: >> Hmmm, >> >> Does this work? >> >> <def tag="view" for="Location"> >> <a href="&this.website.to_s"><%= h this.website.to_s %> </a> >> </def> >> >> If website is a string, this shouldn't change anything. However, the >> default `view` of an object is a link, so wrapping it in another `a` >> would mess things up. >> >> Bryan >> >> skeemer wrote: >>> Ok, I'm back at it again. Simpler this time. I'm just trying to >>> turn a >>> url into a link. I have a field called website and I want it to >>> display but also be clickable. I tried something similar to >>> suggested, >>> but that didn't work. >> >>> <def tag="view" for="Location"> >>> <a href="&this.website"><view:website /></a> >>> </def> >> >>> Any other ideas? >> >>> On Apr 16, 3:36 pm, skeemer <[email protected]> wrote: >>>> That didn't work for what I needed, but that doesn't mean it >>>> doesn't >>>> work... At any rate, mention of the "card"tagcaused me to dig into >>>> the manual for that and found out about /app/views/taglibs/auto/ >>>> rapid/ >>>> cards.dryml. I copied the generated card into application.dryml and >>>> added the link around the name. That worked great for what I was >>>> trying to do. I think the code provided will help later on as I'm >>>> working on the app front-end. >> >>>> cheers! >>>> Leo >> >>>> On Apr 16, 12:41 pm, Bryan Larsen <[email protected]> wrote: >> >>>>> This is the sort of thing that Hobo is good at. >>>>> I don't completely understand what you're asking, but you might >>>>> want >>>>> something like: >>>>> <deftag="view" for="PersonLink"> >>>>> <a href="&this.url"><view:name /></a> >>>>> </def> >>>>> The othertagthat you might want to redefine/extend similarly would >>>>> be the "card"tag. >>>>> cheers, >>>>> Bryan >>>>> On Apr 16, 1:37 pm, skeemer <[email protected]> wrote: >>>>>> I have a Person and PersonLink models. The PersonLink has :name >>>>>> and :url. What I would like to do is anytime that :name is >>>>>> displayed, >>>>>> it is turned into a real link. Like on the page for editing >>>>>> people, it >>>>>> lists the link names, but I want those names to be real links >>>>>> to the >>>>>> associated :url. I don't want to change it for just that page, >>>>>> though. >>>>>> Basically, anytime that a PersonLink is displayed, :name will >>>>>> be a >>>>>> link. >>>>>> Maybe this is simple, but I'm a Hobo noob and still trying to >>>>>> wrap my >>>>>> mind around DRYML and Rapid. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
