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

Views overlaying over one another #2

Closed
mt-davis opened this issue Apr 27, 2016 · 5 comments
Closed

Views overlaying over one another #2

mt-davis opened this issue Apr 27, 2016 · 5 comments

Comments

@mt-davis
Copy link

When I installed devise, it's over laying the login screen for devise over the main page view 'plainpage#index'. It also happens when a create a controller and view for a model.

@mt-davis
Copy link
Author

@ornerymoose and @Katagena are you experiencing similar issues?

@iogbole
Copy link
Owner

iogbole commented Apr 30, 2016

Hey @mt-davis - thanks for resolving issue 1 and apologies for the delay it was a very busy week.

I used devise as well and I have a created a gist of the login page for you - https://gist.github.com/iogbole/a2f1ddf330cb5194967a1996369619e8. *

The trick is to create a second application layout and use that for 'external facing' views, i.e views that don't require login. Ref - http://stackoverflow.com/questions/15228228/multiple-layouts-in-ror

For all other controllers and views, you'd need to copy all the contents between and and modify them manually.

I will try to add some scaffold automation to the template when time permits.

Hope the helps?

  • I used gist because I wanna keep the template as clean as possible.

@iogbole iogbole closed this as completed Apr 30, 2016
@TheAshwanik
Copy link

Hi @iogbole ..
I am still not able use the layouts. I saved the gist as you mentioned. But I still see the overlapping.
Could you please give me more directions?

@iogbole
Copy link
Owner

iogbole commented Feb 24, 2017

@TheAshwanik did you define the layout in the controller or method? For example:

class ExternalpagesController < ApplicationController
  layout "external_pages", except: [:index, :faqs]

  def about_us
  end

  def team
  end

  def faqs
    #renders with views/layouts/application.html.erb
  end
end

here, about_us and team will render using the external_pages layout, not the default application layout.

See details here - http://guides.rubyonrails.org/layouts_and_rendering.html

@TheAshwanik
Copy link

ohk.. This is good to know.But I did not try that.
But I was able to make it work, when I saved your layout as devise.html.erb under layouts. and now all devise related pages open with the layout you had as "external_pages layout" .
Is that a bad practice?

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

No branches or pull requests

3 participants