1 class ProfilesController < ApplicationController
 
   4   before_action :authorize_web
 
   5   before_action :set_locale
 
   7   authorize_resource :class => false
 
   9   before_action :check_database_readable
 
  10   before_action :check_database_writable, :only => [:update]
 
  15     social_links_params = params.permit(:user => [:social_links_attributes => [:id, :url, :_destroy]])
 
  16     current_user.assign_attributes(social_links_params[:user])
 
  18     if params[:user][:description] != current_user.description
 
  19       current_user.description = params[:user][:description]
 
  20       current_user.description_format = "markdown"
 
  23     case params[:avatar_action]
 
  25       current_user.avatar.attach(params[:user][:avatar])
 
  26       current_user.image_use_gravatar = false
 
  28       current_user.avatar.purge_later
 
  29       current_user.image_use_gravatar = false
 
  31       current_user.avatar.purge_later
 
  32       current_user.image_use_gravatar = true
 
  35     current_user.company = params[:user][:company]
 
  37     current_user.home_lat = params[:user][:home_lat]
 
  38     current_user.home_lon = params[:user][:home_lon]
 
  39     current_user.home_location_name = params[:user][:home_location_name]
 
  42       flash[:notice] = t ".success"
 
  43       redirect_to user_path(current_user)
 
  45       flash.now[:error] = t ".failure"