1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-08-14 17:59:45 +02:00

Achievement unicity && management pop-up behaviour

This commit is contained in:
Ehouarn
2025-08-13 23:57:05 +02:00
parent 61057b71ba
commit 4d567cdcc7
6 changed files with 111 additions and 47 deletions

View File

@@ -25,11 +25,6 @@ $(document).ready(function () {
location.hash = this.getAttribute('href')
})
// Ensure we begin in single consumption. Fix issue with TurboLinks and BootstrapJS
document.getElementById("consume_all").addEventListener('click', consumeAll)
})
notes = []
@@ -140,13 +135,25 @@ function consumeAll () {
headers: {
'X-CSRFToken': CSRF_TOKEN
},
success: function () {
success: function (data) {
reset()
addMsg("Défis validés pour les familles!", 'success', 5000)
},
error: function (e) {
reset()
addMsg("Erreur lors de la création des achievements.",'danger',5000)
data.results.forEach(function (result) {
if (result.status === 'created') {
addMsg(
interpolate(gettext('Invalid achievement for challenge %s ' +
'and family %s created.'), [result.challenge, result.family]),
'success',
5000
)
} else {
addMsg(
interpolate(gettext('An achievement for challenge %s ' +
'and family %s already exists.'), [result.challenge, result.family]),
'danger',
8000
)
}
})
}
})
}