Hello,
Allmost all pages have the same layout except the login page.
There the sidebar with menu is not visible.
Is there a way to tell rails that when im on the login page the sidebar
must not be visible.
Roelof
Hello,
Allmost all pages have the same layout except the login page.
There the sidebar with menu is not visible.
Is there a way to tell rails that when im on the login page the sidebar
must not be visible.
Roelof
you could use current_page with route to check the page. Ex:
render “sidebar” unless current_page?(login_path)
Matt
oke , and put this in the controller ??
Roelof
Op woensdag 13 augustus 2014 08:26:52 UTC+2 schreef matt:
No, the render command goes in your layout in this case since it is
something that a lot of your views are using.
<%= render “sidebar” unless current_page?(login_path) %>
You have to look in your routes file what is your login_path.
login_path is just a example.
2014-08-13 15:24 GMT-03:00 Roelof W. [email protected]:
run “rake routes” in cosole to see your login path.
2014-08-13 16:08 GMT-03:00 Germano T. [email protected]:
Sorry but I do not work. I see a message that login_path is not known.
I
think that devise is messing things up.
Roelof
Op woensdag 13 augustus 2014 17:56:23 UTC+2 schreef Eric S.:
Rake routes :
Prefix Verb URI Pattern Controller#Action
new_admin_session GET /admins/sign_in(.:format)
devise/sessions#new
admin_session POST /admins/sign_in(.:format)
devise/sessions#create
destroy_admin_session DELETE /admins/sign_out(.:format)
devise/sessions#destroy
cancel_admin_registration GET /admins/cancel(.:format)
devise/registrations#cancel
admin_registration POST /admins(.:format)
devise/registrations#create
new_admin_registration GET /admins/sign_up(.:format)
devise/registrations#new
edit_admin_registration GET /admins/edit(.:format)
devise/registrations#edit
PATCH /admins(.:format)
devise/registrations#update
PUT /admins(.:format)
devise/registrations#update
DELETE /admins(.:format)
devise/registrations#destroy
dashboard_show GET /dashboard/show(.:format)
dashboard#show
root GET /
dashboard#show
I tried already new_admin_registration but then I see the same error
message.
Roelof
Op woensdag 13 augustus 2014 21:09:30 UTC+2 schreef Germano T.:
then I see this error message ;
undefined local variable or method `“sidebar”’ for
#<#Class:0x007fc6a2ce9c38:0x007fc6a50d7118>
Where I have a sidebar.html.erb and a _sidebar.html.erb in the same
directory.
Roelof
Op woensdag 13 augustus 2014 22:06:47 UTC+2 schreef Eric S.:
You still need _path. So in your case, since it is the login which I’m
assuming is new_admin_session, it would be
<%= render “sidebar” unless current_page?(new_admin_session_path) %>
Add the folder name where your sidebar partial is located.
<%= render “layouts/sidebar” unless
current_page?(new_admin_session_path) %>
undefined local variable or method `“layouts’ for
#<#Class:0x007f50394a0340:0x007f503949ded8>
Roelof
Op donderdag 14 augustus 2014 13:54:36 UTC+2 schreef James Davis, PhD:
On 14 August 2014 14:10, Roelof W. [email protected] wrote:
undefined local variable or method `“layouts’ for
#<#Class:0x007f50394a0340:0x007f503949ded8>
Show us the line of code that error is generated on (with a couple of
lines each side). Copy/paste it here.
Colin
Here is the whole layout :
Liberator Admin Theme <%= stylesheet_link_tag "bootstrap/bootstrap.css",
“font-awesome-4.0.3/css/font-awesome.min.css”, “jquery-ui.css”,
“toastr.css”, “style.css” %>
The sidebar.html.erb can be found here : http://pastebin.com/4HJ69Pa7
Roelof
Op donderdag 14 augustus 2014 15:56:33 UTC+2 schreef Colin L.:
On 14 August 2014 16:21, Roelof W. [email protected] wrote:
Here is the whole layout :
Look at the stack trace and find which line of your code generated the
error, then post just that section.
Colin
I think you mean this :
Processing by DashboardController#show as HTML
Rendered dashboard/show.html.erb within layouts/application (2.1ms)
Rendered dashboard/show.html.erb within layouts/application (2.1ms)
Completed 500 Internal Server Error in 80ms
Completed 500 Internal Server Error in 80ms
ActionView::Template::Error (undefined local variable or method
“layouts' for #<#<Class:0x007f6269e4a548>:0x007f6269e49080>): 18: </head> 19: <body> 20: 21: <%= render “layouts/sidebar” unless current_page?(new_admin_session_path) %> 22: 23: </body> 24: </html> app/views/layouts/application.html.erb:21:in
_app_views_layouts_application_html_erb___4215202385565524198_70030324135900’
Or do you mean the application.stack, framework trace or the whole
trace.
I see the error when doing rails s
Roelof
Op donderdag 14 augustus 2014 17:52:25 UTC+2 schreef Colin L.:
Thanks,
Im using the ide of nitrious.io but this is the next problem that arise
with wrong characters.
I think I will look for a decent Linux distro and look then for a
solution
where I can have all the files at one window. my code in another and a
terminal as a footer.
Roelof
Op donderdag 14 augustus 2014 19:19:36 UTC+2 schreef Hassan S.:
On Thu, Aug 14, 2014 at 10:10 AM, Roelof W. [email protected]
wrote:
ActionView::Template::Error (undefined local variable or method `“layouts’
for #<#Class:0x007f6269e4a548:0x007f6269e49080>):
21: <%= render “layouts/sidebar” unless
current_page?(new_admin_session_path) %>
What in the name of all that’s merciful are you using as an editor?
Look closely at the error message.
You’re using “smart” (sic) quotes instead of normal double-quote
characters. Fix that and it’ll work as expected.
–
Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan
On 14 August 2014 18:18, Hassan S. [email protected]
wrote:
You’re using “smart” (sic) quotes instead of normal double-quote
characters. Fix that and it’ll work as expected.
Well spotted Hassan. Isn’t it annoying when someone sees something
that one should have seen oneself
Particularly when I am always telling people to look at the error
message.
Colin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs