Add translations for answer ajax controller
This commit is contained in:
parent
80172d0852
commit
9460bcfdd7
|
@ -12,7 +12,7 @@ class Ajax::AnswerController < AjaxController
|
||||||
|
|
||||||
unless current_user == inbox_entry.user
|
unless current_user == inbox_entry.user
|
||||||
@response[:status] = :fail
|
@response[:status] = :fail
|
||||||
@response[:message] = I18n.t('messages.answer.create.fail')
|
@response[:message] = t(".error")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -20,18 +20,11 @@ class Ajax::AnswerController < AjaxController
|
||||||
|
|
||||||
unless question.user.privacy_allow_stranger_answers
|
unless question.user.privacy_allow_stranger_answers
|
||||||
@response[:status] = :privacy_stronk
|
@response[:status] = :privacy_stronk
|
||||||
@response[:message] = I18n.t('messages.answer.create.privacy_stronk')
|
@response[:message] = t(".privacy")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
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
|
answer = if inbox
|
||||||
inbox_entry.answer params[:answer], current_user
|
inbox_entry.answer params[:answer], current_user
|
||||||
else
|
else
|
||||||
|
@ -45,7 +38,7 @@ class Ajax::AnswerController < AjaxController
|
||||||
|
|
||||||
|
|
||||||
@response[:status] = :okay
|
@response[:status] = :okay
|
||||||
@response[:message] = I18n.t('messages.answer.create.okay')
|
@response[:message] = t(".success")
|
||||||
@response[:success] = true
|
@response[:success] = true
|
||||||
unless inbox
|
unless inbox
|
||||||
# this assign is needed because shared/_answerbox relies on it, I think
|
# 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)
|
unless (current_user == answer.user) or (privileged? answer.user)
|
||||||
@response[:status] = :nopriv
|
@response[:status] = :nopriv
|
||||||
@response[:message] = I18n.t('messages.answer.destroy.nopriv')
|
@response[:message] = t(".nopriv")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,7 +64,7 @@ class Ajax::AnswerController < AjaxController
|
||||||
answer.destroy
|
answer.destroy
|
||||||
|
|
||||||
@response[:status] = :okay
|
@response[:status] = :okay
|
||||||
@response[:message] = I18n.t('messages.answer.destroy.okay')
|
@response[:message] = t(".success")
|
||||||
@response[:success] = true
|
@response[:success] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,14 @@ en:
|
||||||
destroy:
|
destroy:
|
||||||
nopriv: "Cannot remove a block belonging to someone else."
|
nopriv: "Cannot remove a block belonging to someone else."
|
||||||
success: :ajax.relationship.destroy.block.success
|
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:
|
comment:
|
||||||
create:
|
create:
|
||||||
invalid: "Your comment is too long."
|
invalid: "Your comment is too long."
|
||||||
|
|
|
@ -56,15 +56,6 @@ en:
|
||||||
error: "An error occurred."
|
error: "An error occurred."
|
||||||
parameter_error: "%{parameter} is required."
|
parameter_error: "%{parameter} is required."
|
||||||
noauth: "requires authentication"
|
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:
|
report:
|
||||||
create:
|
create:
|
||||||
login: "login required"
|
login: "login required"
|
||||||
|
|
Loading…
Reference in New Issue