iogbole / gentelella_on_rails

Gentelella Admin Bootstrap Template on Rails 4

Home Page:https://github.com/iogbole/gentelella_on_rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Views overlaying over one another

mt-davis opened this issue · comments

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.

@ornerymoose and @Katagena are you experiencing similar issues?

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.

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?

@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

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?