Class: UserSettingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/user_settings_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_navable, #current_navable=, #current_user, #point_navigation_to, #redirect_www_subdomain, #set_locale

Instance Method Details

#indexObject

/settings



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/user_settings_controller.rb', line 6

def index
  authorize! :update, user
  
  @user = user
  @navable = @user
  
  @user.update_last_seen_activity "nimmt Benutzereinstellungen vor"
  
  render action: 'show'
end

#showObject

/users/123/settings



18
19
20
21
22
23
24
# File 'app/controllers/user_settings_controller.rb', line 18

def show
  @user = user
  authorize! :update, user
  
  @navable = @user
  current_user.update_last_seen_activity "nimmt Benutzereinstellungen vor"
end

#updateObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/user_settings_controller.rb', line 26

def update
  @user = user
  authorize! :update, @user
  
  if not user_params[:incognito].nil?
    if user_params[:incognito] == true
      current_user.update_last_seen_activity nil
    end
    
    if user_params[:incognito] == 'true'
      @user.incognito = true
    elsif user_params[:incognito] == 'false'
      @user.incognito = false
    end
    @user.save
  end

  render nothing: true
end