Auto-fill personal profile from other conference

This commit is contained in:
Petko Bordjukov 2016-10-09 04:20:45 +03:00
parent ff00f63b7c
commit e762acebfb
2 changed files with 8 additions and 6 deletions

View File

@ -26,18 +26,18 @@ module Management
def new
@conference = find_conference
@profile = @conference.participant_profiles.
build(user_id: params[:user_id])
@user = User.find params[:user_id]
@profile = @user.build_personal_profile(@conference)
end
def create
@conference = find_conference
@profile = PersonalProfile.new(profile_params)
@profile.conference = @conference
@user = User.find(profile_params[:user_id])
@profile = @user.build_personal_profile(@conference, profile_params)
if @profile.save
flash[:notice] = 'Profile was successfully created.'
redirect_to action: :index
flash[:notice] = t('.successfully_created')
redirect_to management_conference_personal_profile_path(@profile, conference_id: @conference.id)
else
render action: :new
end

View File

@ -4,6 +4,8 @@ bg:
index:
no_profile: 'Този потребител няма въведен профил за текущата конференция.'
total: "%{current} от общо %{total}"
create:
successfully_created: "Профилът беше създаден успешно."
conferences:
show:
summary: 'Обобщение'