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 def new
@conference = find_conference @conference = find_conference
@profile = @conference.participant_profiles. @user = User.find params[:user_id]
build(user_id: params[:user_id]) @profile = @user.build_personal_profile(@conference)
end end
def create def create
@conference = find_conference @conference = find_conference
@profile = PersonalProfile.new(profile_params) @user = User.find(profile_params[:user_id])
@profile.conference = @conference @profile = @user.build_personal_profile(@conference, profile_params)
if @profile.save if @profile.save
flash[:notice] = 'Profile was successfully created.' flash[:notice] = t('.successfully_created')
redirect_to action: :index redirect_to management_conference_personal_profile_path(@profile, conference_id: @conference.id)
else else
render action: :new render action: :new
end end

View File

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