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
|
||||
|
||||
if current_user.theme.save
|
||||
flash[:success] = 'Theme saved.'
|
||||
flash[:success] = t(".success")
|
||||
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
|
||||
elsif current_user.theme.update(update_attributes)
|
||||
flash[:success] = 'Theme saved.'
|
||||
flash[:success] = t(".success")
|
||||
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
|
||||
redirect_to edit_user_theme_path
|
||||
end
|
||||
|
|
|
@ -31,3 +31,6 @@ en:
|
|||
update_profile:
|
||||
success: :user.update.success
|
||||
error: :user.update.error
|
||||
update_theme:
|
||||
success: "Theme saved successfully."
|
||||
error: "Theme saving failed. %{errors}"
|
||||
|
|
Loading…
Reference in New Issue