ViewFu

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 railsjedi.com

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.

%divhidden #=> <div style=“display:none”> %div=> @posts.empty?) #=> hide the .posts div if the array is empty %div=> @posts.empty?) #=> hide the empty posts message if the array has elements %div: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.

meta_tags output all the html meta tags currently on the page

meta_keywords output the meta keywords tag

meta_keywords(val) set the page meta keywords

meta_description output the meta description tag

meta_description(val) 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