skip getting started button sets getting_started to false via js and redirects to root_path

This commit is contained in:
danielvincent 2010-10-27 12:53:46 -07:00
parent b906dd5a1d
commit 335bd9c96a
2 changed files with 14 additions and 3 deletions

View file

@ -22,7 +22,6 @@ class UsersController < ApplicationController
@user = current_user @user = current_user
if params[:user][:getting_started] if params[:user][:getting_started]
puts "here"
boolean = params[:user][:getting_started] == "true" boolean = params[:user][:getting_started] == "true"
@user.update_attributes( :getting_started => boolean ) @user.update_attributes( :getting_started => boolean )
redirect_to root_path redirect_to root_path
@ -38,10 +37,10 @@ class UsersController < ApplicationController
flash[:error] = "Password Change Failed" flash[:error] = "Password Change Failed"
end end
end end
end
redirect_to edit_user_path(@user) redirect_to edit_user_path(@user)
end end
end
def destroy def destroy
current_user.destroy current_user.destroy

View file

@ -3,6 +3,18 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
- if current_user.getting_started == true
:javascript
$("#getting_started_skip").live("click", function(evt){
evt.preventDefault();
$.ajax({
type: "PUT",
url: "/users/#{current_user.id}",
data: {"user":{"getting_started":'false'}},
success: function() { window.location = "#{root_path}"}
})
});
.span-8.append-1.last .span-8.append-1.last
%h1{:style => "text-align:right;"} %h1{:style => "text-align:right;"}
= "Welcome to Diaspora!" = "Welcome to Diaspora!"