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:
@@ -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
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user