1
0
forked from ScoDoc/ScoDoc

Merge pull request 'Saisie notes : masquer DEM & ne pas copier coller' (#554) from lehmann/ScoDoc-Front:master into master

Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/554
This commit is contained in:
Emmanuel Viennet 2023-01-11 21:37:45 +01:00
commit 61575c43ac
2 changed files with 28 additions and 2 deletions

View File

@ -1049,7 +1049,19 @@ def saisie_notes(evaluation_id, group_ids=[]):
alone=True, alone=True,
) )
) )
H.append("""</td></tr></table></div>""") H.append("""</td><td style="padding-left: 35px;"><button class="btn_masquer_DEM">Masquer les DEM</button></td></tr></table></div>""")
H.append("""<style>
.btn_masquer_DEM{
font-size: 12px;
}
body.masquer_DEM .btn_masquer_DEM{
background: #009688;
color: #fff;
}
body.masquer_DEM .etud_dem{
display: none !important;
}
</style>""")
# Le formulaire de saisie des notes: # Le formulaire de saisie des notes:
destination = url_for( destination = url_for(

View File

@ -5,6 +5,7 @@ $().ready(function () {
$("#formnotes .note").bind("blur", valid_note); $("#formnotes .note").bind("blur", valid_note);
$("#formnotes input").bind("paste", paste_text); $("#formnotes input").bind("paste", paste_text);
$(".btn_masquer_DEM").bind("click", masquer_DEM);
}); });
@ -92,6 +93,7 @@ function paste_text(e) {
var data = clipb.getData('Text'); var data = clipb.getData('Text');
var list = data.split(/\r\n|\r|\n|\t| /g); var list = data.split(/\r\n|\r|\n|\t| /g);
var currentInput = event.currentTarget; var currentInput = event.currentTarget;
var masquerDEM = document.querySelector("body").classList.contains("masquer_DEM");
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
currentInput.value = list[i]; currentInput.value = list[i];
@ -99,7 +101,15 @@ function paste_text(e) {
evt.initEvent("blur", false, true); evt.initEvent("blur", false, true);
currentInput.dispatchEvent(evt); currentInput.dispatchEvent(evt);
var sibbling = currentInput.parentElement.parentElement.nextElementSibling; var sibbling = currentInput.parentElement.parentElement.nextElementSibling;
while (sibbling && sibbling.style.display == "none") { while (
sibbling &&
(
sibbling.style.display == "none" ||
(
masquerDEM && sibbling.classList.contains("etud_dem")
)
)
) {
sibbling = sibbling.nextElementSibling; sibbling = sibbling.nextElementSibling;
} }
if (sibbling) { if (sibbling) {
@ -112,3 +122,7 @@ function paste_text(e) {
} }
} }
} }
function masquer_DEM(){
document.querySelector("body").classList.toggle("masquer_DEM");
}