SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 260 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"

rhtml in the example application. Notice
that contextual help links are added with a rel attribute of "help" throughout the form. The
rel attribute describes the relationship of the link to the resource and is a very convenient
hook for many types of scripts. Later you??™ll use the rel attribute to determine whether the
resulting content in the help sidebar should display when a link is clicked. You could also use
a class name to differentiate help links from other normal links on the page, but in this case it
seems most semantically correct to specify a relationship.
These links point to various pages within the help section. In the example code the help
section is hooked up for you, but it??™s worth having a brief look at the controller code:
class HelpController < ApplicationController
def show
render :template => '/help/' + params[:path].join('/'), :layout => 'help'
end
end
For those not familiar with Rails or Ruby, this action renders the specified template from
within app/views/help with the layout named help. For instance, the URL /help/sprocket will
render the template at app/views/help/sprocket.rhtml. (I put a few example help pages in
there for you.) The help layout looks fairly similar to the main page layout. Try clicking one of
the help links and you??™ll see the result: the help content is rendered in its own page.
You have achieved your first goal: you have a formwith working links to your help content.


Pages:
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272