On Apr 3, 2011, at 12:56 PM, Peter Booth wrote: > I'm looking at the rapid-rails-3-with-hobo-beta-1.pdf and trying to > comprehend how to best do something in Hobo: > > For 95% of my application teh default behavior to build page titles works > well. But in one place, where I have a a custom controller action, > that maps to a scope on my model, I want to customize the behavior. > > So the default behavior is fine for: > http://myapp/businesses has Page Title "Businesses: My App" > > but I don't want http://myapp/businesses/retail to have the same page title. > I want to define it as "Retail Businesses: My App." > > Nowe the latest beta of the Rails 3 book, on page 456, gives an example of > how to customize page titles: > > <def tag="page"> > <html> > <head> <title param>My Blog</title> > </head> > <body param> > </html> > </def> > > <page> > <title:>My VERY EXCITING Blog</title:> > <body:> > ... body content > </body:> > </page> > > > Here there are two changes: > 1. The default page behavior is now that all pages will be called "My Blog" > 2. The page that contains the second block of code will instead have a > different title. > > Now in my application I already define my views/business/retail.dryml to be > an index page that uses a scoped collection and also shows a different set > of attributes... > > <index-page > > <collection: replace> > <div> > <table-plus fields="id,this,summary, business.name, taxid, pci, > retail_license_number"/> > </div> > </collection:> > </index-page> > > But I dont want to remove the default page behavior - I just want to > customize it for one instance. > > Does this mean that I still need to both modify the <page> tag for the entire > page (in application.dryml) and also inject the custom param for just my view?
Nope - unless you've redefined it, the <page> tag defined by Rapid (in rapid_pages.dryml) already does this. In fact, it's got a shorthand that lets you keep the ": My App" part while changing the first part. Pass the 'title' option to index-page in retail.dryml: <index-page title="Retail Businesses"> ... and it should get exactly the result you're looking for. --Matt JOnes -- 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.
