开发者

advance/basic and smartphone views in Rails

开发者 https://www.devze.com 2023-01-04 11:16 出处:网络
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).

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 开发者_Python百科3 views/layout ? What is the best way to use respond_to ?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消