Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
Update user custom field handling
Dieser Commit ist enthalten in:
Ursprung
d837a7c9bc
Commit
ce1cbd5e8c
3 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen
|
@ -180,6 +180,7 @@
|
||||||
valueContent=profileFields
|
valueContent=profileFields
|
||||||
keyContent=availableFields
|
keyContent=availableFields
|
||||||
noneValue='admin.wizard.action.update_profile.profile_field'
|
noneValue='admin.wizard.action.update_profile.profile_field'
|
||||||
optionalCustom=true}}
|
optionalCustom=true
|
||||||
|
inputValue='admin.wizard.action.update_profile.custom_field'}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -105,6 +105,7 @@ en:
|
||||||
update_profile:
|
update_profile:
|
||||||
label: "Update Profile"
|
label: "Update Profile"
|
||||||
profile_field: "Profile Field"
|
profile_field: "Profile Field"
|
||||||
|
custom_field: "User Custom Field"
|
||||||
post_builder:
|
post_builder:
|
||||||
checkbox: "Post Builder"
|
checkbox: "Post Builder"
|
||||||
label: "Builder"
|
label: "Builder"
|
||||||
|
|
|
@ -82,8 +82,7 @@ class CustomWizard::Builder
|
||||||
attribute = update['value']
|
attribute = update['value']
|
||||||
custom_field = update['value_custom']
|
custom_field = update['value_custom']
|
||||||
if custom_field
|
if custom_field
|
||||||
name = custom_field.split('.').try(:last) || nil
|
params[:value] = UserCustomField.where(user_id: @wizard.user.id, name: custom_field).pluck(:value)
|
||||||
params[:value] = UserCustomField.where(user_id: @wizard.user.id, name: name).pluck(:value)
|
|
||||||
elsif UserProfile.column_names.include? attribute
|
elsif UserProfile.column_names.include? attribute
|
||||||
params[:value] = UserProfile.find_by(user_id: @wizard.user.id).send(attribute)
|
params[:value] = UserProfile.find_by(user_id: @wizard.user.id).send(attribute)
|
||||||
elsif User.column_names.include? attribute
|
elsif User.column_names.include? attribute
|
||||||
|
@ -294,12 +293,11 @@ class CustomWizard::Builder
|
||||||
|
|
||||||
a['profile_updates'].each do |pu|
|
a['profile_updates'].each do |pu|
|
||||||
value = pu['value']
|
value = pu['value']
|
||||||
custom_value = pu['value_custom']
|
custom_field = pu['value_custom']
|
||||||
key = pu['key']
|
key = pu['key']
|
||||||
|
|
||||||
if custom_value
|
if custom_field
|
||||||
name = custom_value.split('.').try(:last) || nil
|
custom_fields[custom_field] = data[key]
|
||||||
custom_fields[name] = data[key]
|
|
||||||
else
|
else
|
||||||
attributes[value.to_sym] = data[key]
|
attributes[value.to_sym] = data[key]
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren