// Valider les réponses
$(document).on("click", ".next .action", function () {
let responses = $this.responses
- $this.validateResponse(responses);
- $this.next();
+ $this.next(responses);
})
key('space', function (e){
e.preventDefault()
e.preventDefault()
$this.resetForm()
})
+
+ //
+ this.activeNav()
},
updateIcons: function () {
this.resize.resize();
},
- next: function () {
+ next: function (responses) {
const $el = $(".active-screen .btn.action")
- const form = $(".active-screen form")
+ let status = quiz.score.questionStatus
+ let currentPosition = this.question.currentPosition()
+
+ quiz.score.updateScore()
// if form exist and responses are validated
// dont miss to add this second condition
- if(form.length > 0) {
- return false
+ if($(".active-screen form").length > 0) {
+ if(status.length > 0) {
+ if(status[currentPosition].ok === "not answered") {
+ this.validateResponse(responses);
+ this.updateBtnValidation("validated")
+ return false
+ }
+ }
}
+
$el.parents(".container-screen").addClass("none").removeClass("next active-screen").next(".container-screen").removeClass("none").addClass("next active-screen")
this.resetForm()
+ this.activeNav(currentPosition)
+ this.updateBtnValidation()
},
setDisplay: function() {
$("form").find("input").prop("checked", false)
},
+ updateBtnValidation: function(status) {
+ let $btnAction = $("#footer .action"),
+ validationText = $btnAction.data("validation-text"),
+ continueText = $btnAction.data("continue-text")
+
+ $btnAction.find('.text').text(status === "validated" ? continueText : validationText)
+ },
+
validateResponse: function(responses) {
const form = $(".active-screen form")
const activeScreen = $(".active-screen")
}
},
+ activeNav: function(position = 1) {
+ const questionStatus = quiz.score.questionStatus
+ let $el = $(".progress-container .progress-item:nth-child("+position+")")
+ $el.addClass("active")
+
+ for(let k in questionStatus) {
+ let $el = $(".progress-container .progress-item:nth-child("+k+")")
+ if(questionStatus[k].ok === 'ok') {
+ $el.addClass("ok")
+ }else if(questionStatus[k].ok === 'nok'){
+ $el.addClass("nok")
+ }
+ }
+ },
+
animationValidation: function(status) {
let selector = $("#anim")
- this.animations.load(status, selector, {'\\$text': 'Salut :)'});
+ let text = status === "NOK" ? "Not quite" : "Perfect"
+ this.animations.load(status, selector, {'\\$text': text});
selector.addClass("active")
setTimeout(function(){
selector.removeClass("active")
width: 100%
height: 58px
@extend .radius
- background-color: $neutral-color
+ +opacity(.80,background-color,$neutral-color)
+flex-config(space-between,false,false,center)
padding: 0 16px
cursor: pointer
border: 2px solid rgba($texts-color, .24)
position: relative
overflow: hidden
- &.ok
- //
- &.nok
- //
- &.neutral
- //
- &.missed
+ &:after
+ content: ""
+ width: 100%
+ height: 100%
+ position: absolute
+ top: 0
+ left: 0
+ &.ok:after,
+ &.missed:after
//
- +opacity(.80,background-color,$neutral-color)
+ +opacity(.24,background-color,$ok-color)
+
*
z-index: 1
input:checked+label
border-color: $texts-color
&:after
- content: ""
- width: 100%
- height: 100%
+opacity(.16)
- position: absolute
- top: 0
- left: 0
&.nok:after
background: transparent
- &.missed:after
- +opacity(.24,background-color,$ok-color)