Thanks for your help!
But unfortunately I can't quite follow you.
1. You mean I should be redirected to my login page, with the
login-content being invisivle?
Actually I want some kind of Login Box, that pops up anywhere, since
several features in my application are filtered by a "require login"
helper-method.
I bothered to find a way redirecting to the current page after a login,
and using ajax I wouldn't have to deal with that. So I need a Solution
that replaces any "redirec to login_form"-method with an event, that
pops up a login-box!
So far my Login (creating the Session) is working fine. My Login Form
looks like this
<%= form_tag sessions_path, :remote => true do %>
I also have put this login form in a partial, that is rendered by
jQuery, whenever I click on "login" which doesn't have a path-helper but
only a class.
So what I'm missing out is, that this only works, when I click on
"login", but once a login is required due to a "require_login" method, I
get redirected to my Loginform Page.
This is my Helper Method
def require_login
unless user_signed_in?
redirect_to login_path,
alert: "You need to login first"
end
end
How do I change that so I don't get routed to some other page, but a
hidden div gets revealed?
render :partial => "sessions/login" only renders a compoletely white
page with no styles.
This is my jQuery function
$(document).ready ->
$(".button_login").click ->
$(".login").show()
It only responds to this very login button, but not the redirecting
method...
I hope you can follow me and help me out...thanks in advance!!