app/views/layouts/application.rhtml:
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"
content="application/xhtml+xml" />
<title><%= title %></title>
<%= javascript_include_tag "prototype" %>
<%= stylesheet_link_tag "application.css" %>
<%= stylesheet_link_tag "#{controller.controller_path}.css"
%>
</head>
<body xml:lang="en">
<div id="sidepane">
<%= render :partial => ''layouts/sidepane'' %>
</div>
<div id="main">
<%= @content_for_layout %>
</div>
</body>
</html>
app/view/layouts/_sidepane.rhtml:
<div id="user">
<% if @user.nil? %>
<h4>Please log in</h4>
<% form_remote_for :login, :update => "sidepane",
:url => "/login/sidepane" do |f| %>
<div><label for="id">Id:</label>
<%= f.text_field :id %></div>
<div><label for="pass">Password:</label>
<%= f.password_field :pass %><div>
<div><%= submit_tag "Log in" %></div>
<% end %>
<% else %>
<h4>User</h4>
<div>First name: <%= @user.first_name %></div>
<div>Last name: <%= @user.last_name %></div>
<div><% form_tag "/login/logout" do %>
<%= submit_tag "Log out" %>
<% end %></div>
<% end %>
</div>
app/controllers/login_controller.rb:
class LoginController < ApplicationController
def sidepane
do_login params[:login] if request.post?
render :partial => ''layouts/sidepane''
end
def logout
session[:user_id] = ""
redirect_to "/"
end
def do_login login
if request.post?
# I''m add password checking later
session[:user_id] = User.find(login[:id])
end
end
private :do_login
end
If I try to login it deletes div#main (firebug said it as well) and do
not update div#sidepane. What''s wrong?
Regards
--
I''ve probably left my head... somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---