Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Clarity on fallback behavior #35

Open
eprothro opened this issue Sep 11, 2013 · 2 comments
Open

Clarity on fallback behavior #35

eprothro opened this issue Sep 11, 2013 · 2 comments

Comments

@eprothro
Copy link

Gents, I've used mobylette on a few projects over the years and have had a few fallback issues at times -- I think I assumed they were all fixed in 3.x, but ran into a few again. So, first I wanted to start this discussion to see what the expected fallback behavior is.

Gherkin just for clarity...

Given the request for "pages#primary" is a mobile request
And "views/pages/primary.html.haml" exists
And "views/pages/primary.mobile.haml" does NOT exist
And the primary view template renders the "partial" partial
And "views/pages/_partial.html.haml" exists
And "views/pages/_partial.mobile.haml" exists
When the partial is rendered

I would expect the fallback behavior to result in:

Then the "_partial.mobile.haml" file is rendered

However my experience is:
I would expect the fallback behavior to be:

Then the "_partial.html.haml" file is rendered

There are similar behaviors with layout rendering.

What is the desired behavior form your perspective?

@tscolari
Copy link
Owner

I think that's exactly what I had in mind,
but there is another point we should consider, is that if the partial is crafted for the mobile layout/view, probably it will fit wrongly on the "desktop" one. What do you think?

@eprothro
Copy link
Author

So glad you agree :)

Good question, but I don't think so, actually. The most straight forward
expectation to set is that if there is a mobile template available, it will
be used in a mobile request.

In fact, in my application, having a single HTML layout with certain
partials that are overridden for mobile is desired.

In that corner case you mention, the user could explicitly set the format
for the partial render to work around the expected behavior.

render partial: 'layouts/_partial', formats: [:html]

What's the best way to move forward to implement this new/corrected
behavior, in your mind?

-Evan Prothro
Sent from my mobile

On Sep 19, 2013, at 3:43 AM, Tiago Scolari notifications@github.com wrote:

I think that's exactly what I had in mind,
but there is another point we should consider, is that if the partial is
crafted for the mobile layout/view, probably it will fit wrongly on the
"desktop" one. What do you think?


Reply to this email directly or view it on
GitHubhttps://github.com//issues/35#issuecomment-24724561
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants