1
0
Fork 0

Add existing profile values to fields associated with profile update actions

Dieser Commit ist enthalten in:
Angus McLeod 2017-11-06 19:50:19 +08:00
Ursprung 7f15e2a657
Commit 5d8dce986d

Datei anzeigen

@ -61,6 +61,22 @@ class CustomWizard::Builder
params[:value] = submission[f['id']] if submission[f['id']]
end
if s['actions'].any?
profile_actions = s['actions'].select { |a| a['type'] === 'update_profile' }
if profile_actions.any?
profile_actions.each do |action|
if update = action['profile_updates'].select { |u| u['key'] === f['id'] }.first
attribute = update['value']
if UserProfile.column_names.include? attribute
params[:value] = UserProfile.find_by(user_id: @wizard.user.id).send(attribute)
elsif User.column_names.include? attribute
params[:value] = User.find(@wizard.user.id).send(attribute)
end
end
end
end
end
field = step.add_field(params)
if f['type'] === 'dropdown'