Merge branch 'vFront' into 'master'
VFront See merge request LETU/LETU!18
This commit is contained in:
commit
85a3e821ac
7 changed files with 75 additions and 29 deletions
|
@ -18,4 +18,9 @@ socket.on("logout", data=>{
|
|||
}else{
|
||||
window.location.href = "/";
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
function profilRedirect(){
|
||||
document.location.href="/profil";
|
||||
}
|
11
public/javascripts/marks.js
Normal file
11
public/javascripts/marks.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
function setVisible(targetId) {
|
||||
document.getElementById("notvisible").id = "visible";
|
||||
}
|
||||
|
||||
function setNotVisible(targetId) {
|
||||
document.getElementById(targetId).id = "notvisible";
|
||||
}
|
||||
|
||||
function marksformChange(targetId) {
|
||||
document.getElementById("marksform").style.display = "block";
|
||||
}
|
21
public/javascripts/profil.js
Normal file
21
public/javascripts/profil.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
let socket = io.connect();
|
||||
|
||||
document.getElementById("editprofil").addEventListener("submit", e=>{
|
||||
e.preventDefault();
|
||||
socket.emit("profileEdit", {
|
||||
"email": mail,
|
||||
"firstName": document.getElementById("firstname-input").value,
|
||||
"lastName": document.getElementById("lastname-input").value,
|
||||
"newPassword": document.getElementById("new-password").value,
|
||||
"password": document.getElementById("password").value
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
socket.on("profileEdit", data=>{
|
||||
if(data.error){
|
||||
alert(data.error.message);
|
||||
}else{
|
||||
window.location.href = "/";
|
||||
}
|
||||
})
|
|
@ -487,4 +487,10 @@ div#visible + div
|
|||
border-radius: 2px
|
||||
display: block
|
||||
margin: auto
|
||||
cursor: pointer
|
||||
cursor: pointer
|
||||
|
||||
#notvisible
|
||||
display: none
|
||||
|
||||
#marksform
|
||||
display: none
|
||||
|
|
|
@ -12,6 +12,7 @@ module.exports = socket => {
|
|||
user.firstName = data.firstName;
|
||||
if (data.lastName !== user.lastName)
|
||||
user.lastName = data.lastName;
|
||||
user.newPassword = data.newPassword;
|
||||
if (data.password && !user.checkPassword(data.password))
|
||||
user.passwordHash = data.password
|
||||
socket.request.session.user = user;
|
||||
|
|
|
@ -2,7 +2,7 @@ extends ../template/navbar
|
|||
|
||||
block content
|
||||
if student === true
|
||||
div(class="marksdetails" id="visibl")
|
||||
div(class="marksdetails" id="notvisible" onclick="setNotVisible(this.getAttribute('id'))")
|
||||
table
|
||||
tr
|
||||
th(colspan="2") Details
|
||||
|
@ -22,24 +22,24 @@ block content
|
|||
th(colspan="2") Maths
|
||||
tbody
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
|
||||
|
@ -50,17 +50,17 @@ block content
|
|||
th(colspan="2") TP SE
|
||||
tbody
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
|
||||
|
@ -71,17 +71,17 @@ block content
|
|||
th(colspan="2") PHP
|
||||
tbody
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
|
||||
|
@ -92,17 +92,17 @@ block content
|
|||
th(colspan="2") Anglais
|
||||
tbody
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
tr
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 1
|
||||
p 18/20
|
||||
td
|
||||
td(onclick="setVisible(this.getAttribute('id'))")
|
||||
p DS 2
|
||||
p 16/20
|
||||
|
||||
|
@ -111,11 +111,11 @@ block content
|
|||
div(class="col s12 m10 offset-m1 marksgroup")
|
||||
h3 Select a group
|
||||
div(id="flexgroup")
|
||||
p G1S1
|
||||
p G2S2
|
||||
p G3S3
|
||||
p(onclick="marksformChange(this.getAttribute('id'))") G1S1
|
||||
p(onclick="marksformChange(this.getAttribute('id'))") G2S2
|
||||
p(onclick="marksformChange(this.getAttribute('id'))") G3S3
|
||||
|
||||
form
|
||||
form(id="marksform")
|
||||
table(id="markstable")
|
||||
thead
|
||||
tr
|
||||
|
@ -185,4 +185,6 @@ block content
|
|||
input(type="number" value="16")
|
||||
td
|
||||
input(type="number")
|
||||
input(id="marksubmit" type="submit" value="Enregistrer")
|
||||
input(id="marksubmit" type="submit" value="Enregistrer")
|
||||
|
||||
script(src="/javascripts/marks.js")
|
|
@ -2,16 +2,16 @@ extends layout
|
|||
|
||||
block navbar
|
||||
if student === true
|
||||
div(id="navprofile" class="student")
|
||||
div(id="navprofile" class="student" onclick="profilRedirect()")
|
||||
p Kezel Benoit
|
||||
p G4S3
|
||||
a(id="logout") Logout
|
||||
if teacher === true
|
||||
div(id="navprofile" class="teacher")
|
||||
div(id="navprofile" class="teacher" onclick="profilRedirect()")
|
||||
p Kezel Benoit
|
||||
a(id="logout") Logout
|
||||
if admin === true
|
||||
div(id="navprofile" class="admin")
|
||||
div(id="navprofile" class="admin" onclick="profilRedirect()")
|
||||
p Kezel Benoit
|
||||
a(id="logout") Logout
|
||||
|
||||
|
|
Reference in a new issue