Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

handle view helpers for Rails3

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 viewfu.gemspec

ViewFu is a Rails3 plugin that provides all the miscellaneous View tasks. It's a combination of the functionality of BrowserDetect, Headliner, Meta Tags - along with additional tweaks such as providing commonly used View Helpers Methods.

Maintainer Info

Jacques Crocker

ViewFu HTML Helpers
ViewFu provides helpers for commonly used html elements

br #=> <br />
hr #=> <hr />
anchor("posts") #=> <a name='posts'></a>
clear #=> <div class="clear"></div>
clear(:left) #=> <div class="clearleft"></div>
clear_tag(:br) #=> <br class="clear" />
lorem #=> Lorem ipsum dolor...

Haml Specific Helpers
Haml allows you to pash a hash of attributes. ViewFu assists this by providing a simple "hidden" helper that allows you to conditionally hide page elements.

%div{hidden} #=> <div style="display:none">
%div{hidden(:if => @posts.empty?)} #=> hide the .posts div if the array is empty
%div{hidden(:unless => @posts.empty?)} #=> hide the empty posts message if the array has elements
%div{add_class("empty", :if => @posts.empty?)} #=> add the "empty" class if the array is empty

Meta Tags
ViewFu allows you to set meta tags on your page header from anywhere. Just add a call to meta_tags somewhere in your page header.

output all the html meta tags currently on the page

output the meta keywords tag

set the page meta keywords

output the meta description tag

set the page meta description

Browser Detect

browser_is? :ie
browser_is? :ie6
browser_is? :ie7
browser_is? :iphone
browser_is? :webkit
browser_is? :firefox

Released under the MIT license
Something went wrong with that request. Please try again.