NEW FEATURE: can upload avatar in a wizard step
Dieser Commit ist enthalten in:
Ursprung
5befcd2f23
Commit
938e29fe3f
3 geänderte Dateien mit 12 neuen und 2 gelöschten Zeilen
|
@ -12,6 +12,7 @@ const ACTION_TYPES = [
|
|||
|
||||
const PROFILE_FIELDS = [
|
||||
'name',
|
||||
'user_avatar',
|
||||
'date_of_birth',
|
||||
'title',
|
||||
'locale',
|
||||
|
|
|
@ -256,6 +256,8 @@ export default {
|
|||
valid = val;
|
||||
} else if (type === 'category') {
|
||||
valid = val && val.toString().length > 0;
|
||||
} else if (type === 'upload') {
|
||||
valid = val && val.id > 0;
|
||||
} else if (StandardFieldValidation.indexOf(type) > -1) {
|
||||
valid = val && val.length > 0;
|
||||
}
|
||||
|
|
|
@ -476,13 +476,20 @@ class CustomWizard::Builder
|
|||
custom_fields[user_field || custom_field] = data[key]
|
||||
else
|
||||
updater_key = value
|
||||
|
||||
if ['profile_background', 'card_background'].include?(value)
|
||||
updater_key = "#{value}_upload_url"
|
||||
end
|
||||
|
||||
attributes[updater_key.to_sym] = data[key] if updater_key
|
||||
end
|
||||
|
||||
if ['user_avatar'].include?(value)
|
||||
this_upload_id = data[key][:id]
|
||||
user.create_user_avatar unless user.user_avatar
|
||||
user.user_avatar.custom_upload_id = this_upload_id
|
||||
user.uploaded_avatar_id = this_upload_id
|
||||
user.save!
|
||||
user.user_avatar.save!
|
||||
end
|
||||
end
|
||||
|
||||
if custom_fields.present?
|
||||
|
|
Laden …
In neuem Issue referenzieren