mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:29:52 +01:00
localize javascript
This commit is contained in:
parent
d3aec1faea
commit
d13cdb27dc
19 changed files with 77 additions and 73 deletions
|
@ -41,11 +41,11 @@ $(document).on "keyup", "input[name=ab-comment-new]", (evt) ->
|
|||
$("span#ab-comment-count-#{aid}").html data.count
|
||||
subs = $("a[data-action=ab-submarine][data-a-id=#{aid}]")[0]
|
||||
subs.dataset.torpedo = "no"
|
||||
subs.children[0].nextSibling.textContent = "Unsubscribe"
|
||||
subs.children[0].nextSibling.textContent = translate('views.actions.unsubscribe')
|
||||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
input.removeAttr 'disabled'
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) ->
|
|||
btn = $(this)
|
||||
cid = btn[0].dataset.cId
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this comment."
|
||||
title: translate('frontend.destroy_comment.confirm.title')
|
||||
text: translate('frontend.destroy_comment.confirm.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
cancelButtonText: "Cancel"
|
||||
confirmButtonText: translate('views.actions.delete')
|
||||
cancelButtonText: translate('views.actions.cancel')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
|
@ -23,5 +23,5 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
|
|
|
@ -28,7 +28,7 @@ $(document).on "click", "button[name=ab-smile-comment]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
if success
|
||||
|
|
|
@ -3,13 +3,13 @@ $(document).on "click", "a[data-action=ab-destroy]", (ev) ->
|
|||
btn = $(this)
|
||||
aid = btn[0].dataset.aId
|
||||
swal
|
||||
title: "Are you sure?"
|
||||
text: "The question will be moved back to your inbox, but it won't delete any posts to social media."
|
||||
title: translate('frontend.destroy_question.confirm.title')
|
||||
text: translate('frontend.destroy_question.confirm.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Yes"
|
||||
cancelButtonText: "No"
|
||||
confirmButtonText: translate('views.actions.yes')
|
||||
cancelButtonText: translate('views.actions.no')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
|
@ -23,5 +23,5 @@ $(document).on "click", "a[data-action=ab-destroy]", (ev) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
|
|
|
@ -28,7 +28,7 @@ $(document).on "click", "button[name=ab-smile]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
if success
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
error: (jqxhr, status, error) ->
|
||||
box[0].checked = false
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
box.removeAttr "disabled"
|
||||
|
||||
|
@ -54,7 +54,7 @@ $(document).on "keyup", "input#new-group-name", (evt) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
|
||||
|
@ -65,13 +65,13 @@ $(document).on "keyup", "input#new-group-name", (evt) ->
|
|||
group = btn[0].dataset.group
|
||||
|
||||
swal
|
||||
title: "Really delete this group?"
|
||||
text: "You will not be able to recover this group."
|
||||
title: translate('frontend.group.title')
|
||||
text: translate('frontend.group.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
cancelButtonText: "Cancel"
|
||||
confirmButtonText: translate('views.actions.delete')
|
||||
cancelButtonText: translate('views.actions.cancel')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
|
@ -86,5 +86,5 @@ $(document).on "keyup", "input#new-group-name", (evt) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
del_all_btn[0].dataset.ibCount = (Number del_all_btn[0].dataset.ibCount) + 1
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
|
||||
|
@ -23,13 +23,13 @@
|
|||
btn = ($ this)
|
||||
count = btn[0].dataset.ibCount
|
||||
swal
|
||||
title: "Really delete #{count} questions?"
|
||||
text: "They will be gone forever."
|
||||
title: translate('frontend.inbox.confirm_all.title', {count: count})
|
||||
text: translate('frontend.inbox.confirm_all.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
cancelButtonText: "Cancel"
|
||||
confirmButtonText: translate('views.actions.delete')
|
||||
cancelButtonText: translate('views.actions.cancel')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
btn.button "loading"
|
||||
|
@ -48,7 +48,7 @@
|
|||
entries.fadeIn()
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
if succ
|
||||
# and now: a (broken?) re-implementation of Bootstrap's button.js
|
||||
|
@ -88,7 +88,7 @@ $(document).on "click", "button[name=ib-answer]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
$("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly"
|
||||
|
@ -97,13 +97,13 @@ $(document).on "click", "button[name=ib-answer]", ->
|
|||
$(document).on "click", "button[name=ib-destroy]", ->
|
||||
btn = $(this)
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "This question will be gone forever."
|
||||
title: translate('frontend.inbox.confirm.title')
|
||||
text: translate('frontend.inbox.confirm.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
cancelButtonText: "Cancel"
|
||||
confirmButtonText: translate('views.actions.delete')
|
||||
cancelButtonText: translate('views.actions.cancel')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
btn.button "loading"
|
||||
|
@ -120,7 +120,7 @@ $(document).on "click", "button[name=ib-destroy]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
$("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly"
|
||||
|
|
|
@ -54,5 +54,5 @@ $(document).on "DOMContentLoaded", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
|
|
|
@ -42,7 +42,7 @@ $(document).on "keyup", "input[name=mod-comment-new]", (evt) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
input.removeAttr 'disabled'
|
||||
|
||||
|
@ -71,12 +71,13 @@ $(document).on "click", "a[data-action=mod-comment-destroy]", (ev) ->
|
|||
btn = $(this)
|
||||
cid = btn[0].dataset.id
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this comment."
|
||||
title: translate('frontend.destroy_comment.confirm.title')
|
||||
text: translate('frontend.destroy_comment.confirm.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
confirmButtonText: translate('views.actions.delete')
|
||||
cancelButtonText: translate('views.actions.cancel')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
|
@ -90,5 +91,5 @@ $(document).on "click", "a[data-action=mod-comment-destroy]", (ev) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
|
|
|
@ -2,12 +2,13 @@ $(document).on "click", "button[name=mod-delete-report]", ->
|
|||
btn = $(this)
|
||||
id = btn[0].dataset.id
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this report."
|
||||
title: translate('frontend.destroy_report.confirm.title')
|
||||
text: translate('frontend.destroy_report.confirm.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
confirmButtonText: translate('views.actions.delete')
|
||||
cancelButtonText: translate('views.actions.cancel')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
|
@ -21,5 +22,5 @@ $(document).on "click", "button[name=mod-delete-report]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
|
@ -19,6 +19,6 @@
|
|||
error: (jqxhr, status, error) ->
|
||||
box[0].checked = false
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
box.removeAttr "disabled"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
if success
|
||||
switch action
|
||||
|
|
|
@ -31,7 +31,7 @@ $(document).on "click", "button#q-answer", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
$("textarea#q-answer").removeAttr "readonly"
|
||||
|
|
|
@ -24,7 +24,7 @@ $(document).on "click", "button[name=qb-all-ask]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
$("textarea[name=qb-all-question]").removeAttr "readonly"
|
||||
|
|
|
@ -3,13 +3,13 @@ $(document).on "click", "a[data-action=ab-question-destroy]", (ev) ->
|
|||
btn = $(this)
|
||||
qid = btn[0].dataset.qId
|
||||
swal
|
||||
title: "Are you sure?"
|
||||
text: "The question will be removed."
|
||||
title: translate('frontend.delete_own.confirm.title')
|
||||
text: translate('frontend.delete_own.confirm.text')
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Yes"
|
||||
cancelButtonText: "No"
|
||||
confirmButtonText: translate('views.actions.yes')
|
||||
cancelButtonText: translate('views.actions.no')
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
|
@ -26,5 +26,5 @@ $(document).on "click", "a[data-action=ab-question-destroy]", (ev) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
|
|
|
@ -23,7 +23,7 @@ $(document).on "click", "button[name=qb-ask]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
$("textarea[name=qb-question]").removeAttr "readonly"
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
window.reportDialog = (type, target, callback) ->
|
||||
swal
|
||||
title: "Really report this #{type}?"
|
||||
text: "A moderator will review your report and decide what happens.\nIf you'd like, you can also specify a reason."
|
||||
title: translate('frontend.report.confirm.title', {type: type})
|
||||
text: translate('frontend.report.confirm.text')
|
||||
type: "input"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Report"
|
||||
confirmButtonText: translate('views.actions.report')
|
||||
cancelButtonText: translate('views.actions.cancel')
|
||||
closeOnConfirm: true
|
||||
inputPlaceholder: "Specify a reason..."
|
||||
inputPlaceholder: translate('frontend.report.confirm.input')
|
||||
, (value) ->
|
||||
if typeof value == "boolean" && value == false
|
||||
return false
|
||||
|
@ -23,6 +24,6 @@ window.reportDialog = (type, target, callback) ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
callback type, target, jqxhr, status
|
||||
|
|
|
@ -30,7 +30,7 @@ $(document).on "click", "button[name=user-action]", ->
|
|||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
showNotification translate('frontend.error.message'), false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
if success
|
||||
|
@ -38,11 +38,11 @@ $(document).on "click", "button[name=user-action]", ->
|
|||
when 'follow'
|
||||
btn[0].dataset.action = 'unfollow'
|
||||
btn.attr 'class', 'btn btn-default btn-block profile--follow-btn'
|
||||
btn.html 'Unfollow'
|
||||
btn.html translate('views.actions.unfollow')
|
||||
when 'unfollow'
|
||||
btn[0].dataset.action = 'follow'
|
||||
btn.attr 'class', 'btn btn-primary btn-block profile--follow-btn'
|
||||
btn.html 'Follow'
|
||||
btn.html translate('views.actions.follow')
|
||||
|
||||
|
||||
# report user
|
||||
|
|
|
@ -22,15 +22,6 @@
|
|||
en:
|
||||
frontend:
|
||||
load: "Load more"
|
||||
# is frontend.actions needed? we can use views.actions
|
||||
actions:
|
||||
delete: "Delete"
|
||||
cancel: "Cancel"
|
||||
report: "Report"
|
||||
follow: "Follow"
|
||||
unfollow: "Unfollow"
|
||||
yes: "Yes"
|
||||
no: "No"
|
||||
success:
|
||||
title: "Success!"
|
||||
error:
|
||||
|
@ -54,6 +45,14 @@ en:
|
|||
confirm:
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this comment."
|
||||
destroy_report:
|
||||
confirm:
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this report."
|
||||
destroy_own:
|
||||
confirm:
|
||||
title: "Are you sure?"
|
||||
text: "The question will be removed."
|
||||
inbox:
|
||||
empty: "Nothing to see here."
|
||||
confirm_all:
|
||||
|
@ -279,6 +278,8 @@ en:
|
|||
cancel: "Cancel"
|
||||
close: "Close"
|
||||
done: "Done"
|
||||
yes: "Yes"
|
||||
no: "No"
|
||||
sessions:
|
||||
destroy: "Logout"
|
||||
create: "Sign in"
|
||||
|
|
Loading…
Reference in a new issue