views:

19

answers:

1

In a new Rail app I have to consider 2 differents user's type: basic and Advanced

and I have to create smartphone views( unique view for both user's type).

Then I have 3 view/layout:

  • web advance
  • web basic
  • smartphone

I already have the adv/basic flag for the user, and I followed the RBates tutorial http://asciicasts.com/episodes/199-mobile-devices.

What is the best way to manage the 3 views/layout ? What is the best way to use respond_to ?

Thank you, Alessandro

+2  A: 

Check out the Mobile Fu plugin, it lets you use respond_to like:

respond_to do |format|
  format.html {
    render :action => "full" 
  }
  format.mobile {
    render :action => "full",
  }
  format.js {
    render :partial => "content", :layout => false
  }
end

But depending on the device, you could create your our format.dumb by hooking into the plugin and:

Mime::Type.register_alias "text/html", :mobile
Jesse Wolgamott
Mobile Fu is very useful,but I have to manage too the advanced/basic views (not only web standard and mobile views)thank you,Alessandro
Right right --- I was thinking you'd go into the guts of mobile_fu and create a format.smartphone and format.dumbphone based on their decently extensive browser listing.Course, if there's a better way, I'd love to see it, but customizing mobile_fu works.
Jesse Wolgamott