Add translations for question ajax controller
This commit is contained in:
parent
2237ff8f04
commit
80172d0852
|
@ -10,20 +10,20 @@ class Ajax::QuestionController < AjaxController
|
||||||
question = Question.find params[:question]
|
question = Question.find params[:question]
|
||||||
if question.nil?
|
if question.nil?
|
||||||
@response[:status] = :not_found
|
@response[:status] = :not_found
|
||||||
@response[:message] = I18n.t('messages.question.destroy.not_found')
|
@response[:message] = t(".notfound")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (current_user.mod? or question.user == current_user)
|
if not (current_user.mod? or question.user == current_user)
|
||||||
@response[:status] = :not_authorized
|
@response[:status] = :not_authorized
|
||||||
@response[:message] = I18n.t('messages.question.destroy.not_authorized')
|
@response[:message] = t(".noauth")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
question.destroy!
|
question.destroy!
|
||||||
|
|
||||||
@response[:status] = :okay
|
@response[:status] = :okay
|
||||||
@response[:message] = I18n.t('messages.question.destroy.okay')
|
@response[:message] = t(".success")
|
||||||
@response[:success] = true
|
@response[:success] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class Ajax::QuestionController < AjaxController
|
||||||
rescue ActiveRecord::RecordInvalid => e
|
rescue ActiveRecord::RecordInvalid => e
|
||||||
Sentry.capture_exception(e)
|
Sentry.capture_exception(e)
|
||||||
@response[:status] = :rec_inv
|
@response[:status] = :rec_inv
|
||||||
@response[:message] = I18n.t('messages.question.create.rec_inv')
|
@response[:message] = t(".invalid")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class Ajax::QuestionController < AjaxController
|
||||||
|
|
||||||
if target_user.nil?
|
if target_user.nil?
|
||||||
@response[:status] = :not_found
|
@response[:status] = :not_found
|
||||||
@response[:message] = I18n.t('messages.question.create.not_found')
|
@response[:message] = t(".notfound")
|
||||||
question.delete
|
question.delete
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -90,7 +90,7 @@ class Ajax::QuestionController < AjaxController
|
||||||
end
|
end
|
||||||
|
|
||||||
@response[:status] = :okay
|
@response[:status] = :okay
|
||||||
@response[:message] = I18n.t('messages.question.create.okay')
|
@response[:message] = t(".success")
|
||||||
@response[:success] = true
|
@response[:success] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,6 +82,15 @@ en:
|
||||||
noauth: :messages.noauth
|
noauth: :messages.noauth
|
||||||
nopriv: :ajax.mute_rule.nopriv
|
nopriv: :ajax.mute_rule.nopriv
|
||||||
success: "Rule deleted successfully."
|
success: "Rule deleted successfully."
|
||||||
|
question:
|
||||||
|
create:
|
||||||
|
invalid: "Your question is too long."
|
||||||
|
notfound: "User not found."
|
||||||
|
success: "Question asked successfully."
|
||||||
|
destroy:
|
||||||
|
notfound: "Question does not exist."
|
||||||
|
noauth: "You are not allowed to delete this question."
|
||||||
|
success: "Successfully deleted question."
|
||||||
relationship:
|
relationship:
|
||||||
create:
|
create:
|
||||||
block:
|
block:
|
||||||
|
|
|
@ -65,15 +65,6 @@ en:
|
||||||
destroy:
|
destroy:
|
||||||
nopriv: "can't delete other people's answers"
|
nopriv: "can't delete other people's answers"
|
||||||
okay: "Successfully deleted answer."
|
okay: "Successfully deleted answer."
|
||||||
question:
|
|
||||||
destroy:
|
|
||||||
not_found: "Question does not exist"
|
|
||||||
not_authorized: "You are not allowed to delete this question"
|
|
||||||
okay: "Successfully deleted question."
|
|
||||||
create:
|
|
||||||
rec_inv: "Your question is too long."
|
|
||||||
not_found: "List not found"
|
|
||||||
okay: "Question asked successfully."
|
|
||||||
report:
|
report:
|
||||||
create:
|
create:
|
||||||
login: "login required"
|
login: "login required"
|
||||||
|
|
Loading…
Reference in New Issue