2015-08-15 03:43:41 +03:00
|
|
|
module Public
|
|
|
|
class PersonalProfilesController < Public::ApplicationController
|
|
|
|
before_filter :authenticate_user!
|
|
|
|
|
|
|
|
def create
|
|
|
|
@profile = current_user.build_personal_profile(current_conference, profile_params)
|
|
|
|
|
|
|
|
if @profile.save
|
2015-08-15 10:04:03 +03:00
|
|
|
flash[:notice] = t('views.personal_profiles.successfully_created')
|
2015-08-15 03:43:41 +03:00
|
|
|
redirect_to root_path
|
|
|
|
else
|
|
|
|
render action: :new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
2015-08-15 08:01:48 +03:00
|
|
|
@profile = current_user.find_or_build_personal_profile(current_conference)
|
2015-08-15 03:43:41 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@profile = current_user.personal_profile(current_conference)
|
|
|
|
|
|
|
|
if @profile.update_attributes(profile_params)
|
2015-08-15 10:04:03 +03:00
|
|
|
flash[:notice] = t('views.personal_profiles.successfully_updated')
|
2015-08-15 03:43:41 +03:00
|
|
|
redirect_to root_path
|
|
|
|
else
|
|
|
|
render action: 'edit'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def profile_params
|
|
|
|
params.require(:personal_profile).permit(
|
|
|
|
:picture, :picture_cache, :first_name, :last_name, :public_email,
|
|
|
|
:organisation, :github, :twitter, :mobile_phone, :biography
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|