-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev: fixed some rendering bugs in frontend and backend
- Loading branch information
Showing
26 changed files
with
271 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
$(document).ready(function(){ | ||
$(document).on('ready pjax:complete',function(){ | ||
|
||
/* End of show/hide sections */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.ajax_loading_indicator { | ||
height: 6px; | ||
position: fixed; | ||
display:none; | ||
top: 1px; | ||
left: 0; | ||
width: 100%; | ||
width: 100vw; | ||
z-index: 20000; | ||
transition: opacity 500ms linear; | ||
transition-delay: 1000ms; | ||
} | ||
|
||
|
||
.ajax_loading_indicator .ajax_loading_indicator { | ||
display: none; | ||
height: 8px; | ||
border-radius: 1px; | ||
-webkit-transition-timing-function: ease-in-out; | ||
transition-timing-function: ease-in-out; | ||
/* Safari */ | ||
-webkit-transition: width 1.6s; | ||
transition: width 1.6s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Submit the form with Ajax | ||
var AjaxSubmitObject = function () { | ||
var activeSubmit = false; | ||
// First we get the value of the button clicked (movenext, submit, prev, etc) | ||
var move = ""; | ||
|
||
var startLoadingBar = function () { | ||
$('#ajax_loading_indicator').css('display','block').find('#ajax_loading_indicator_bar').css({ | ||
'width': '20%', | ||
'display': 'block' | ||
}); | ||
}; | ||
|
||
|
||
var endLoadingBar = function () { | ||
$('#ajax_loading_indicator').css('opacity','0').find('#ajax_loading_indicator_bar').css('width', '100%'); | ||
setTimeout(function () { | ||
$('#ajax_loading_indicator').css({'display': 'none', 'opacity': 1}).find('#ajax_loading_indicator_bar').css({ | ||
'width': '0%', | ||
'display': 'none' | ||
}); | ||
}, 1800); | ||
}; | ||
|
||
var bindActions = function () { | ||
|
||
// Always bind to document to not need to bind again | ||
$(document).on("click", ".ls-move-btn",function () { | ||
move = $(this).attr("value"); | ||
}); | ||
|
||
// If the user try to submit the form | ||
// Always bind to document to not need to bind again | ||
$(document).on("submit", "#limesurvey", function (e) { | ||
e.preventDefault(); | ||
|
||
// Prevent multiposting | ||
//Check if there is an active submit | ||
//If there is -> return immediately | ||
if(activeSubmit) return; | ||
//block further submissions | ||
activeSubmit = true; | ||
|
||
//start the loading animation | ||
startLoadingBar(); | ||
|
||
var sUrl = $(this).attr("action"); | ||
var aPost = $(this).serialize(); | ||
|
||
// We add the value of the button clicked to the post request | ||
aPost += "&move=" + move; | ||
|
||
$.ajax({ | ||
url: sUrl, | ||
type: 'POST', | ||
dataType: 'html', | ||
data: aPost, | ||
|
||
success: function (body_html, status, request) { | ||
|
||
$('.toRemoveOnAjax').each(function () { | ||
$(this).remove(); | ||
}); | ||
|
||
var currentUrl = window.location.href; | ||
var cleanUrl = currentUrl.replace("&newtest=Y", "").replace(/\?newtest=Y(\&)?/, '?'); | ||
|
||
if (currentUrl != cleanUrl) { | ||
window.history.pushState({ | ||
"html": body_html, | ||
"pageTitle": request.getResponseHeader('title') | ||
}, "", cleanUrl); | ||
} | ||
|
||
var $dataScripts = $(body_html).filter('script'); | ||
var $newBody = $($.parseHTML(body_html)); | ||
var $replaceableContainer = $newBody.find('div#dynamicReloadContainer'); | ||
$("#dynamicReloadContainer").empty().append($replaceableContainer); | ||
|
||
$dataScripts.each(function () { | ||
$(this).attr('type', 'text/javascript').addClass('toRemoveOnAjax').prependTo('body'); | ||
}); | ||
|
||
// We end the loading animation | ||
endLoadingBar(); | ||
|
||
//free submitting again | ||
activeSubmit = false; | ||
|
||
//also trigger the pjax:complete event to load all adherent scripts | ||
$(document).trigger('pjax:complete'); | ||
|
||
}, | ||
|
||
error: function (result, status, error) { | ||
alert("ERROR"); | ||
console.log(result); | ||
} | ||
}); | ||
}); | ||
}; | ||
return { | ||
bindActions: bindActions, | ||
startLoadingBar: startLoadingBar, | ||
endLoadingBar: endLoadingBar, | ||
unsetSubmit: function(){activeSubmit = false;}, | ||
blockSubmit: function(){activeSubmit = true;} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.