I have a javascript function that shows a login pane above what's currently on the page. I know that in my controllers I can do:
respond_to do |format|
format.html
format.js
end
But I want to be able to trigger Javascript from my sessions_helpers' method signed_in_user which is placed throughout my controllers as:
:before_filter signed_in_user
def signed_in_user
unless signed_in?
store_location
redirect_to signin_path, notice: "Please sign in."
end
end
Essentially I would only need to call
return false; //stop the redirect
$('#loginwindow').fadeIn(); or $('#loginwindow').show()
Which would allow me to deal with users who both have and don't have javascript, But is there anyway to fire javascript like this from a helper?