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]
|
||||
if question.nil?
|
||||
@response[:status] = :not_found
|
||||
@response[:message] = I18n.t('messages.question.destroy.not_found')
|
||||
@response[:message] = t(".notfound")
|
||||
return
|
||||
end
|
||||
|
||||
if not (current_user.mod? or question.user == current_user)
|
||||
@response[:status] = :not_authorized
|
||||
@response[:message] = I18n.t('messages.question.destroy.not_authorized')
|
||||
@response[:message] = t(".noauth")
|
||||
return
|
||||
end
|
||||
|
||||
question.destroy!
|
||||
|
||||
@response[:status] = :okay
|
||||
@response[:message] = I18n.t('messages.question.destroy.okay')
|
||||
@response[:message] = t(".success")
|
||||
@response[:success] = true
|
||||
end
|
||||
|
||||
|
@ -44,7 +44,7 @@ class Ajax::QuestionController < AjaxController
|
|||
rescue ActiveRecord::RecordInvalid => e
|
||||
Sentry.capture_exception(e)
|
||||
@response[:status] = :rec_inv
|
||||
@response[:message] = I18n.t('messages.question.create.rec_inv')
|
||||
@response[:message] = t(".invalid")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Ajax::QuestionController < AjaxController
|
|||
|
||||
if target_user.nil?
|
||||
@response[:status] = :not_found
|
||||
@response[:message] = I18n.t('messages.question.create.not_found')
|
||||
@response[:message] = t(".notfound")
|
||||
question.delete
|
||||
return
|
||||
end
|
||||
|
@ -90,7 +90,7 @@ class Ajax::QuestionController < AjaxController
|
|||
end
|
||||
|
||||
@response[:status] = :okay
|
||||
@response[:message] = I18n.t('messages.question.create.okay')
|
||||
@response[:message] = t(".success")
|
||||
@response[:success] = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -82,6 +82,15 @@ en:
|
|||
noauth: :messages.noauth
|
||||
nopriv: :ajax.mute_rule.nopriv
|
||||
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:
|
||||
create:
|
||||
block:
|
||||
|
|
|
@ -65,15 +65,6 @@ en:
|
|||
destroy:
|
||||
nopriv: "can't delete other people's answers"
|
||||
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:
|
||||
create:
|
||||
login: "login required"
|
||||
|
|
Loading…
Reference in New Issue