Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to html if no mobile or tablet templates defined #21

Closed
wants to merge 4 commits into from

Conversation

SentulAsia
Copy link

Code obtained from https://github.com/cannikin/format_fallback
Do you want me to update the readme about the origin of this particular code?

@benlangfeld
Copy link
Owner

A few things:

  1. I take the lack of any license in that repo to mean it's public domain. I would, however, think that a comment inline with the code with an attribution might be nice.
  2. I would feel more comfortable about this change if it was possible to disable it (eg MobileFu.fallback = false or similar).

@benlangfeld
Copy link
Owner

Tagging @cannikin

@cannikin
Copy link

Hi there! Yeah I can add the MIT licence into that repo if it helps.

@iRonin
Copy link

iRonin commented Jul 16, 2012

I'm getting the following error while trying to use this patch:

Error during failsafe response: wrong number of arguments (6 for 5)
  ruby-1.9.3-p194/bundler/gems/mobile-fu-ae03da5edb30/lib/mobile-fu.rb:174:in `find_with_default_template'
  ruby-1.9.3-p194/gems/actionpack-3.1.3/lib/action_view/lookup_context.rb:85:in `find'

I think it won't work with Rails 3.2.x

Zaid M. Said and others added 2 commits July 17, 2012 16:40
@SentulAsia
Copy link
Author

can u enlighten me on how to add the MobileFu.fallback = false ? Sry but i am familiar with rails but new to gem and plugins...

@benlangfeld
Copy link
Owner

I'd like to make sure the issue reported by @iRonin is addressed. I won't merge this if it is incompatible with 3.x.

As for disabling, you would simply need to check a class var on MobileFu each time you handle MissingTemplate.

@johnnyshields
Copy link

Perhaps this syntax can be used (in controller):

has_mobile_fu   # fallback and mime to true
has_mobile_fu  :fallback => false
has_mobile_fu  :mime => false     # disables :mobile mime type extension

Also, will fallback option cause only :mobile to :html fallback, or does it cause other (unintended) fallbacks from other mime types (:json to :html for example)

@PikachuEXE
Copy link

I want this so much
Now I can just use before_filter to set layout, and custom code in actions to render mobile version templates :(

@jvanbaarsen
Copy link

At this moment you can opt-in actions using: mobile_fu_for :action_name

Maybe thats a work around for you?

Op 27 jun. 2013 om 11:47 heeft PikachuEXE [email protected] het volgende geschreven:

I want this so much
Now I can just use before_filter to set layout, and custom code in actions to render mobile version templates :(


Reply to this email directly or view it on GitHub.

@PikachuEXE
Copy link

The default layout still need application.mobile.haml and that requires other partials like head.mobile.haml
I just want to use head.html.haml if head.mobile.haml does not exist

@seantaylor
Copy link

This fork appears to have a 3.2 compatible version. May want to look there instead of this one.

https://github.com/vivrass/format_fallback/

@SentulAsia
Copy link
Author

Commit is too old and does not confirm to latest rails version...

@SentulAsia SentulAsia closed this Oct 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants