Translate theme update success/error flashes
This commit is contained in:
parent
56d42ebf35
commit
555636577e
|
@ -156,14 +156,14 @@ class UserController < ApplicationController
|
||||||
current_user.theme.user_id = current_user.id
|
current_user.theme.user_id = current_user.id
|
||||||
|
|
||||||
if current_user.theme.save
|
if current_user.theme.save
|
||||||
flash[:success] = 'Theme saved.'
|
flash[:success] = t(".success")
|
||||||
else
|
else
|
||||||
flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.flatten.join(' ')
|
flash[:error] = t(".error", errors: current_user.theme.errors.messages.flatten.join(' '))
|
||||||
end
|
end
|
||||||
elsif current_user.theme.update(update_attributes)
|
elsif current_user.theme.update(update_attributes)
|
||||||
flash[:success] = 'Theme saved.'
|
flash[:success] = t(".success")
|
||||||
else
|
else
|
||||||
flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.flatten.join(' ')
|
flash[:error] = t(".error", errors: current_user.theme.errors.messages.flatten.join(' '))
|
||||||
end
|
end
|
||||||
redirect_to edit_user_theme_path
|
redirect_to edit_user_theme_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,3 +31,6 @@ en:
|
||||||
update_profile:
|
update_profile:
|
||||||
success: :user.update.success
|
success: :user.update.success
|
||||||
error: :user.update.error
|
error: :user.update.error
|
||||||
|
update_theme:
|
||||||
|
success: "Theme saved successfully."
|
||||||
|
error: "Theme saving failed. %{errors}"
|
||||||
|
|
Loading…
Reference in New Issue