mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:29:54 +01:00
Add translations for answer ajax controller
This commit is contained in:
parent
80172d0852
commit
9460bcfdd7
3 changed files with 13 additions and 21 deletions
|
@ -12,7 +12,7 @@ class Ajax::AnswerController < AjaxController
|
|||
|
||||
unless current_user == inbox_entry.user
|
||||
@response[:status] = :fail
|
||||
@response[:message] = I18n.t('messages.answer.create.fail')
|
||||
@response[:message] = t(".error")
|
||||
return
|
||||
end
|
||||
else
|
||||
|
@ -20,18 +20,11 @@ class Ajax::AnswerController < AjaxController
|
|||
|
||||
unless question.user.privacy_allow_stranger_answers
|
||||
@response[:status] = :privacy_stronk
|
||||
@response[:message] = I18n.t('messages.answer.create.privacy_stronk')
|
||||
@response[:message] = t(".privacy")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# this should never trigger because empty params throw ParameterMissing
|
||||
unless params[:answer].length > 0
|
||||
@response[:status] = :peter_dinklage
|
||||
@response[:message] = I18n.t('messages.answer.create.peter_dinklage')
|
||||
return
|
||||
end
|
||||
|
||||
answer = if inbox
|
||||
inbox_entry.answer params[:answer], current_user
|
||||
else
|
||||
|
@ -45,7 +38,7 @@ class Ajax::AnswerController < AjaxController
|
|||
|
||||
|
||||
@response[:status] = :okay
|
||||
@response[:message] = I18n.t('messages.answer.create.okay')
|
||||
@response[:message] = t(".success")
|
||||
@response[:success] = true
|
||||
unless inbox
|
||||
# this assign is needed because shared/_answerbox relies on it, I think
|
||||
|
@ -61,7 +54,7 @@ class Ajax::AnswerController < AjaxController
|
|||
|
||||
unless (current_user == answer.user) or (privileged? answer.user)
|
||||
@response[:status] = :nopriv
|
||||
@response[:message] = I18n.t('messages.answer.destroy.nopriv')
|
||||
@response[:message] = t(".nopriv")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -71,7 +64,7 @@ class Ajax::AnswerController < AjaxController
|
|||
answer.destroy
|
||||
|
||||
@response[:status] = :okay
|
||||
@response[:message] = I18n.t('messages.answer.destroy.okay')
|
||||
@response[:message] = t(".success")
|
||||
@response[:success] = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,14 @@ en:
|
|||
destroy:
|
||||
nopriv: "Cannot remove a block belonging to someone else."
|
||||
success: :ajax.relationship.destroy.block.success
|
||||
answer:
|
||||
create:
|
||||
privacy: "This user does not want other users to answer their question."
|
||||
success: "Successfully answered question."
|
||||
error: "Question is not in your inbox."
|
||||
destroy:
|
||||
nopriv: "Can't delete other people's answers."
|
||||
success: "Successfully deleted answer."
|
||||
comment:
|
||||
create:
|
||||
invalid: "Your comment is too long."
|
||||
|
|
|
@ -56,15 +56,6 @@ en:
|
|||
error: "An error occurred."
|
||||
parameter_error: "%{parameter} is required."
|
||||
noauth: "requires authentication"
|
||||
answer:
|
||||
create:
|
||||
fail: "Question is not in your inbox."
|
||||
privacy_stronk: "This user does not want other users to answer their question."
|
||||
peter_dinklage: "Answer is too short."
|
||||
okay: "Successfully answered question."
|
||||
destroy:
|
||||
nopriv: "can't delete other people's answers"
|
||||
okay: "Successfully deleted answer."
|
||||
report:
|
||||
create:
|
||||
login: "login required"
|
||||
|
|
Loading…
Reference in a new issue