Translate theme update success/error flashes

This commit is contained in:
Andreas Nedbal 2022-02-13 00:58:08 +01:00 committed by Andreas Nedbal
parent 56d42ebf35
commit 555636577e
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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}"