Shadowbox
A.把shared文件夹copy到public/images文件夹下 B.把shadowbox.css样式文件copy到public/stylesheets文件夹下 C.把shadowbox文件夹copy到public/javascripts文件夹下
在layout页面加入
<%= javascript_include_tag 'shadowbox/adapter/shadowbox-base' %> <%= javascript_include_tag 'shadowbox/shadowbox.js' %> <%= stylesheet_link_tag 'shadowbox.css'%> <%= javascript_include_tag 'shadowbox/shadowbox_method.js'%> <script language='javascript'> Shadowbox.loadSkin('classic', '/javascripts/shadowbox/skin'); Shadowbox.loadLanguage('en', '/javascripts/shadowbox/lang'); Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], '/javascripts/shadowbox/player'); </script>
<%= link_to_function '去结算', "get_shadowbox_page('#{url_for :controller => :user,:action => :login2 }')"%>
login2
<% form_tag do -%>
<p><label for="login"> Login </label>
<%= text_field_tag 'login' %></p>
<p><label for="password">Password</label>
<%= password_field_tag 'password' %></p>
<p><%= submit_tag 'Log in' %></p>
<% end -%>
def login2
return unless request.post?
self.current_user = User.authenticate(params[:login], params[:password])
if logged_in?
if params[:remember_me] == "1"
self.current_user.remember_me
cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
end
flash[:notice] = "Logged in successfully"
responds_to_parent do
render :update do |page|
page << "parent.Shadowbox.close();"
page.redirect_to :controller => "order", :action => "write_order_message"
end
end
end
end