mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:39:53 +01:00
Add translations for report ajax controller
This commit is contained in:
parent
9460bcfdd7
commit
e670a50adf
3 changed files with 12 additions and 11 deletions
|
@ -5,13 +5,14 @@ class Ajax::ReportController < AjaxController
|
|||
|
||||
@response[:status] = :err
|
||||
|
||||
if current_user.nil?
|
||||
@response[:message] = I18n.t('messages.report.create.login')
|
||||
unless user_signed_in?
|
||||
@response[:status] = :noauth
|
||||
@response[:message] = t(".noauth")
|
||||
return
|
||||
end
|
||||
|
||||
unless %w(answer comment question user).include? params[:type]
|
||||
@response[:message] = I18n.t('messages.report.create.unknown')
|
||||
@response[:message] = t(".unknown")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -31,14 +32,14 @@ class Ajax::ReportController < AjaxController
|
|||
end
|
||||
|
||||
if object.nil?
|
||||
@response[:message] = I18n.t('messages.report.create.not_found', parameter: params[:type])
|
||||
@response[:message] = t(".notfound", parameter: params[:type])
|
||||
return
|
||||
end
|
||||
|
||||
current_user.report object, params[:reason]
|
||||
|
||||
@response[:status] = :okay
|
||||
@response[:message] = I18n.t('messages.report.create.okay', parameter: params[:type])
|
||||
@response[:message] = t(".success", parameter: params[:type])
|
||||
@response[:success] = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -114,6 +114,12 @@ en:
|
|||
follow:
|
||||
success: "Successfully unfollowed user."
|
||||
error: "You are not following that user."
|
||||
report:
|
||||
create:
|
||||
noauth: :messages.noauth
|
||||
unknown: "You can't report this entity."
|
||||
notfound: "Could not find %{parameter}"
|
||||
success: "%{parameter} reported. A moderator will decide what happens with the %{parameter}."
|
||||
smile:
|
||||
create:
|
||||
success: "Successfully smiled answer."
|
||||
|
|
|
@ -56,12 +56,6 @@ en:
|
|||
error: "An error occurred."
|
||||
parameter_error: "%{parameter} is required."
|
||||
noauth: "requires authentication"
|
||||
report:
|
||||
create:
|
||||
login: "login required"
|
||||
unknown: "unknown type"
|
||||
not_found: "Could not find %{parameter}"
|
||||
okay: "%{parameter} reported. A moderator will decide what happens with the %{parameter}."
|
||||
subscription:
|
||||
torpedo: "418 I'm a torpedo"
|
||||
views:
|
||||
|
|
Loading…
Reference in a new issue