2 class DescriptionsController < ApplicationController
5 before_action :authorize_web
6 before_action :set_locale
8 authorize_resource :class => :profile
10 before_action :check_database_readable
11 before_action :check_database_writable, :only => [:update]
16 social_links_params = params.permit(:user => [:social_links_attributes => [:id, :url, :_destroy]])
17 current_user.assign_attributes(social_links_params[:user])
19 if params[:user][:description] != current_user.description
20 current_user.description = params[:user][:description]
21 current_user.description_format = "markdown"
24 case params[:avatar_action]
26 current_user.avatar.attach(params[:user][:avatar])
27 current_user.image_use_gravatar = false
29 current_user.avatar.purge_later
30 current_user.image_use_gravatar = false
32 current_user.avatar.purge_later
33 current_user.image_use_gravatar = true
36 current_user.company = params[:user][:company]
38 current_user.home_lat = params[:user][:home_lat]
39 current_user.home_lon = params[:user][:home_lon]
40 current_user.home_location_name = params[:user][:home_location_name]
43 flash[:notice] = t ".success"
44 redirect_to user_path(current_user)
46 flash.now[:error] = t ".failure"