Project

renderit

0.0
No commit activity in last 3 years
No release in over 3 years
Renders different templates depending on browser user_agent.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

RenderIt¶ ↑

Main purpose of this gem was to make easier development of websites using html5/css3. The problem that we have at the moment is that old browsers and ALL stable Internet Explorers don’t support html5/css3, but we have to support all the main browsers. To be able to use rounded corners, gradients, css-transformations, application cache and so on we can support two versions of website - one for old browsers and one for new. Browser name and browser version will be defined from user_agent that is sent by all the modern browsers. User expirience in new browser can be much better comparing to the versions of web applications written to work same under all browsers (including old once).

To use this gem you can just install this gem, require it in your rails application and create configuration file conf/renderit.yml In this file you can define regular expressions to define browser name and version (if defaults are not enough). By default renderit supports InternetExplorer, Opera, Firefox, Chrome, Safari, SafariMobile. Also you can define templates that will be rendered for specific browsers. This templates will be used for rendering views as well as layouts. Here is an example of renderit.yml config file:

templates:

new: chrome>=4, firefox>=3.5, opera>=10.5

If Chrome>=4 version, Firefox >= 3.5 version or Opera >= 10.5 version browser is used to get page of your rails application, rails will try to render page with ‘_new’ postfix. For example, not ‘sample_view’ view, but ‘sample_view_new’ view (if it is present). If not - default ‘sample_view’ view will be rendered. Same thing with layouts. If you have ‘application_new’ layout - it will be rendered. If not ‘application’ layout will be used.

In order to use those tempates, default view or layout have to be present. You will not be able to render ‘application_new’ layout in case you have no ‘application’ layout.

Rails compatibility¶ ↑

In order to use this gem with rails 2.3.*, you just have to put ‘config.gem “renderit”’ string in config/environment.rb file.

In order to user this gem with rails 3, you have to require ‘renderit’ gem in Gemfile.

Copyright © 2010 Andrey Romanov. See LICENSE for details.