<commit_before>==== Not ready yet!!!

= Mobylette

This gem works by adding the 'mobile' format to your rails application. Whenever a request come from a mobile device, if you have your controller mobile enabled, it shall render the view.mobile.erb instead of the view.html.erb (or haml, or whatever).

This gem is based on the mobile_fu plugin (https://github.com/brendanlim/mobile-fu). Also these pages were very usefull for me:
 * http://stackoverflow.com/questions/5126085/ruby-on-rails-mobile-application
 * http://www.arctickiwi.com/blog/mobile-enable-your-ruby-on-rails-site-for-small-screens
 * http://metautonomo.us/2011/01/05/mobile-devices-and-rails-maintaining-your-sanity/

== How does it work?

By adding "respond_to_mobile_requests" in your application_controller (or any other controller), your controllers (or that controller) will understand mobile requests as a new mime type alias "mobile". This will make the controller to search for the .mobile.erb file instead of the .html.erb. Also you will be able to do:

    respond_to do |format|
      format.html   { ... }
      format.mobile { ... }
    end

== Instalation

Add the gem to your gemfile:

    gem 'mobylette', :git => "git://github.com/tscolari/mobylette.git"

And add to your ApplicationController.rb (for enabling it to all your controllers) or to the controllers you want this functionality on:

    respond_to_mobile_requests

After that, you may start adding your .mobile. views.

== Helpers

==== is_mobile_request?

This helper returns true if the request comes from a mobile device, false if it does not.

==== mobylette_stylesheet_link_tag(*sources)    - not tested yet

This works like the stylesheet_link_tag helper, but when the request comes from a mobile device, it adds "_mobile" to the stylesheets before calling stylesheet_link_tag

==== mobylette_javascript_include_tag(*soruces) - not tested yet

Same as mobylette_stylesheet_link_tag, but for javascript files and javascript_include_tag

== Fall Backs - not implemented yet

Fall back still a problem. In my POV .mobile should fall back to .html, it's a desirable behavior. But it's not working this way.
In this post - http://metautonomo.us/2011/01/05/mobile-devices-and-rails-maintaining-your-sanity/ - it is an idea that will work (not with this gem), but that could be considered. I still think that it would be a lot better making the .mobile fall back into .html. But as I haven't tryed it yet, I've no more to say, yet.

== Testing

Don't drive your mobylette without your Helmet! It's always safer do tests!<commit_msg>Adding images to the readme =p<commit_after>==== Not ready yet!!!

http://fd.img.v4.skyrock.net/fd6/mantaur/pics/206915407_small.jpg

= Mobylette

This gem works by adding the 'mobile' format to your rails application. Whenever a request come from a mobile device, if you have your controller mobile enabled, it shall render the view.mobile.erb instead of the view.html.erb (or haml, or whatever).

This gem is based on the mobile_fu plugin (https://github.com/brendanlim/mobile-fu). Also these pages were very usefull for me:
 * http://stackoverflow.com/questions/5126085/ruby-on-rails-mobile-application
 * http://www.arctickiwi.com/blog/mobile-enable-your-ruby-on-rails-site-for-small-screens
 * http://metautonomo.us/2011/01/05/mobile-devices-and-rails-maintaining-your-sanity/

== How does it work?

By adding "respond_to_mobile_requests" in your application_controller (or any other controller), your controllers (or that controller) will understand mobile requests as a new mime type alias "mobile". This will make the controller to search for the .mobile.erb file instead of the .html.erb. Also you will be able to do:

    respond_to do |format|
      format.html   { ... }
      format.mobile { ... }
    end

== Instalation

Add the gem to your gemfile:

    gem 'mobylette', :git => "git://github.com/tscolari/mobylette.git"

And add to your ApplicationController.rb (for enabling it to all your controllers) or to the controllers you want this functionality on:

    respond_to_mobile_requests

After that, you may start adding your .mobile. views.

== Helpers

==== is_mobile_request?

This helper returns true if the request comes from a mobile device, false if it does not.

==== mobylette_stylesheet_link_tag(*sources)    - not tested yet

This works like the stylesheet_link_tag helper, but when the request comes from a mobile device, it adds "_mobile" to the stylesheets before calling stylesheet_link_tag

==== mobylette_javascript_include_tag(*soruces) - not tested yet

Same as mobylette_stylesheet_link_tag, but for javascript files and javascript_include_tag

== Fall Backs - not implemented yet

Fall back still a problem. In my POV .mobile should fall back to .html, it's a desirable behavior. But it's not working this way.
In this post - http://metautonomo.us/2011/01/05/mobile-devices-and-rails-maintaining-your-sanity/ - it is an idea that will work (not with this gem), but that could be considered. I still think that it would be a lot better making the .mobile fall back into .html. But as I haven't tryed it yet, I've no more to say, yet.

== Testing

http://image.tin247.com/kenh14/080918143137-689-665.jpg

Don't drive your mobylette without your Helmet! It's always safer do tests!
{'fraction_non_alphanumeric': 0.085520105720219, 'fraction_numerical': 0.015102888427411743, 'mean_word_length': 4.094230769230769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '702700', 'n_tokens_mistral': 1633, 'n_tokens_neox': 1522, 'n_words': 640}