skip getting started is not ajaxy
This commit is contained in:
parent
544ab993ac
commit
34a1a35bf1
3 changed files with 33 additions and 46 deletions
|
|
@ -19,37 +19,30 @@ class UsersController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@user = current_user
|
@user = current_user
|
||||||
|
|
||||||
if params[:user][:getting_started]
|
params[:user].delete(:password) if params[:user][:password].blank?
|
||||||
boolean = params[:user][:getting_started] == "true"
|
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
|
||||||
@user.update_attributes( :getting_started => boolean )
|
params[:user].delete(:language) if params[:user][:language].blank?
|
||||||
redirect_to root_path
|
params[:user].delete(:grammatical_gender) if params[:user][:grammatical_gender].blank?
|
||||||
|
|
||||||
else
|
if params[:user][:password] && params[:user][:password_confirmation]
|
||||||
params[:user].delete(:password) if params[:user][:password].blank?
|
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
|
||||||
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
|
flash[:notice] = I18n.t 'users.update.password_changed'
|
||||||
params[:user].delete(:language) if params[:user][:language].blank?
|
else
|
||||||
params[:user].delete(:grammatical_gender) if params[:user][:grammatical_gender].blank?
|
flash[:error] = I18n.t 'users.update.password_not_changed'
|
||||||
|
end
|
||||||
if params[:user][:password] && params[:user][:password_confirmation]
|
elsif params[:user][:language]
|
||||||
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
|
if @user.update_attributes(:language => params[:user][:language])
|
||||||
flash[:notice] = I18n.t 'users.update.password_changed'
|
if params[:user][:grammatical_gender]
|
||||||
else
|
if @user.update_attributes(:grammatical_gender => params[:user][:grammatical_gender])
|
||||||
flash[:error] = I18n.t 'users.update.password_not_changed'
|
|
||||||
end
|
|
||||||
elsif params[:user][:language]
|
|
||||||
if @user.update_attributes(:language => params[:user][:language])
|
|
||||||
if params[:user][:grammatical_gender]
|
|
||||||
if @user.update_attributes(:grammatical_gender => params[:user][:grammatical_gender])
|
|
||||||
flash[:notice] = I18n.t 'users.update.language_changed'
|
|
||||||
else
|
|
||||||
flash[:error] = I18n.t 'users.update.language_not_changed'
|
|
||||||
end
|
|
||||||
else
|
|
||||||
flash[:notice] = I18n.t 'users.update.language_changed'
|
flash[:notice] = I18n.t 'users.update.language_changed'
|
||||||
|
else
|
||||||
|
flash[:error] = I18n.t 'users.update.language_not_changed'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash[:error] = I18n.t 'users.update.language_not_changed'
|
flash[:notice] = I18n.t 'users.update.language_changed'
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
flash[:error] = I18n.t 'users.update.language_not_changed'
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to edit_user_path(@user)
|
redirect_to edit_user_path(@user)
|
||||||
|
|
@ -96,6 +89,12 @@ class UsersController < ApplicationController
|
||||||
render "users/getting_started"
|
render "users/getting_started"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def getting_started_completed
|
||||||
|
user = current_user
|
||||||
|
user.update_attributes( :getting_started => false )
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
|
||||||
def export
|
def export
|
||||||
exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML)
|
exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML)
|
||||||
send_data exporter.execute(current_user), :filename => "#{current_user.username}_diaspora_data.xml", :type => :xml
|
send_data exporter.execute(current_user), :filename => "#{current_user.username}_diaspora_data.xml", :type => :xml
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,6 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
- 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;"}
|
||||||
= t('.welcome')
|
= t('.welcome')
|
||||||
|
|
@ -71,4 +58,4 @@
|
||||||
|
|
||||||
- if @user.getting_started
|
- if @user.getting_started
|
||||||
.bottom_notification
|
.bottom_notification
|
||||||
= link_to "#{t('.skip')} →", '#', :id => "getting_started_skip"
|
= link_to "#{t('.skip')} →", getting_started_completed_path
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,13 @@ Diaspora::Application.routes.draw do
|
||||||
:password => "devise/passwords",
|
:password => "devise/passwords",
|
||||||
:invitations => "invitations"}
|
:invitations => "invitations"}
|
||||||
# added public route to user
|
# added public route to user
|
||||||
match 'public/:username', :to => 'users#public'
|
match 'public/:username', :to => 'users#public'
|
||||||
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
|
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
|
||||||
match 'users/export', :to => 'users#export'
|
match 'getting_started_completed', :to => 'users#getting_started_completed'
|
||||||
match 'users/export_photos',:to => 'users#export_photos'
|
match 'users/export', :to => 'users#export'
|
||||||
match 'login', :to => 'users#sign_up'
|
match 'users/export_photos', :to => 'users#export_photos'
|
||||||
resources :users, :except => [:create, :new, :show]
|
match 'login', :to => 'users#sign_up'
|
||||||
|
resources :users, :except => [:create, :new, :show]
|
||||||
|
|
||||||
match 'aspects/move_contact', :to => 'aspects#move_contact', :as => 'move_contact'
|
match 'aspects/move_contact', :to => 'aspects#move_contact', :as => 'move_contact'
|
||||||
match 'aspects/add_to_aspect', :to => 'aspects#add_to_aspect', :as => 'add_to_aspect'
|
match 'aspects/add_to_aspect', :to => 'aspects#add_to_aspect', :as => 'add_to_aspect'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue