V1 avec bugs

This commit is contained in:
2026-04-03 15:27:51 +02:00
parent 9ae8dd93de
commit ec78173e05
10 changed files with 387 additions and 9 deletions

View File

@@ -71,6 +71,7 @@ nav {
.nav-element {
line-height: 2.5;
padding: 10px;
margin: 4px;
text-decoration: none;
color: black;
}
@@ -292,9 +293,8 @@ ul {
/*image*/
.recette-image {
background-color: red;
aspect-ratio: 1/1;
max-height: calc( 30vh + 30vw );
max-width: calc( 30vh + 30vw );
max-height: calc( 20vh + 20vw );
max-width: calc( 20vh + 20vw );
border: 1px solid white;
border-radius: 30px;
}
@@ -304,6 +304,35 @@ ul {
justify-content: center;
}
.recette-liste-ingr-div {
margin-left: 120px;
padding-left: 100px;
width: 75%;
border: 1px solid black;
border-radius: 200px;
box-shadow: 7px 4px 7px black;
}
.recette-liste-ingr-elem {
display: flex;
padding-left: 50px;
}
.ingr-image-prev {
max-height: 50px;
max-width: 50px;
border: 1px solid black;
border-radius: 10px;
flex: 1;
}
.recette-liste-ingr-elem-nom {
height: 100%;
width: 15%;
line-height: 50px;
}
.recette-div-info {
display: flex;
flex-direction: row;
@@ -496,12 +525,53 @@ ul {
box-shadow: 1px 1px 1px black;
}
.liste-ingr-elem:hover {
border:3px solid #007054;
box-shadow: 2px 2px 10px black;
}
.liste-ingr-elem-text {
width: 100%;
height: 100%;
flex:12;
padding-left: 20px;
line-height: 100px;
color: #000000;
}
.liste-ingr-elem-modif {
line-height: 100px;
padding-right: 20px;
}
.liste-tag-elem {
display: flex;
height: 40px;
padding:5px;
background-color: #c6fdefe0;
color: #000000;
border: 1px solid black;
border-radius: 10px;
box-shadow: 1px 1px 1px black;
}
.liste-tag-elem:hover {
border:3px solid #007054;
box-shadow: 2px 2px 10px black;
}
.liste-tag-elem-text {
width: 100%;
height: 100%;
flex:12;
padding-left: 20px;
line-height: 40px;
color: #000000;
}
.liste-tag-elem-modif {
line-height: 40px;
padding-right: 20px;
}
.ingr-image {
@@ -510,6 +580,11 @@ ul {
border-radius: 10px;
}
a {
text-decoration: none;
color: black;
}
/*Footer et son contenue*/
footer{
padding: 25px;

View File

@@ -0,0 +1,62 @@
document.addEventListener("DOMContentLoaded", function(){
let modifier_button = document.getElementsByClassName("ingr-modifier");
console.log(modifier_button);
for (const element of modifier_button) {
element.addEventListener('click', function ( e ) {
let modif = element.parentElement.previousSibling.previousSibling;
let data = e.target.getAttribute("data-id");
let form = document.createElement("form");
form.setAttribute("method", "POST");
form.setAttribute("action", "/ingredients/edit/" + data);
form.setAttribute("class","liste-ingr-elem-text")
let input = document.createElement("input");
input.setAttribute("type", "text");
input.setAttribute("class", "form-control");
input.setAttribute("name","modif_ingr");
input.setAttribute("placeholder", "modificiation");
let hidden = document.createElement("input");
hidden.setAttribute("type","hidden");
hidden.setAttribute("name","id");
hidden.setAttribute("value", data);
let button = document.createElement("button");
button.setAttribute("type", "submit");
button.setAttribute("class", "btn btn-primary");
button.innerText = "Submit Modification";
form.append(input)
form.append(hidden)
form.append(button)
modif.replaceWith(form);
});
};
let suppr = document.getElementsByClassName("ingr-suppr");
for (const element of suppr) {
element.addEventListener('click', function ( e ) {
let confirm = window.confirm("Voulez vous supprimez ?");
let data = e.target.getAttribute("data-id");
if (confirm) {
window.location.href = "/ingredients/delete/" + data;
}
})
}
});

View File

@@ -0,0 +1,62 @@
document.addEventListener("DOMContentLoaded", function(){
let modifier_button = document.getElementsByClassName("tag-modifier");
console.log(modifier_button);
for (const element of modifier_button) {
element.addEventListener('click', function ( e ) {
let modif = element.parentElement.previousSibling.previousSibling;
let data = e.target.getAttribute("data-id");
let form = document.createElement("form");
form.setAttribute("method", "POST");
form.setAttribute("action", "/tags/edit/" + data);
form.setAttribute("class","liste-tag-elem-text")
let input = document.createElement("input");
input.setAttribute("type", "text");
input.setAttribute("class", "form-control");
input.setAttribute("name","modif_tag");
input.setAttribute("placeholder", "modificiation");
let hidden = document.createElement("input");
hidden.setAttribute("type","hidden");
hidden.setAttribute("name","id");
hidden.setAttribute("value", data);
let button = document.createElement("button");
button.setAttribute("type", "submit");
button.setAttribute("class", "btn btn-primary");
button.innerText = "Submit Modification";
form.append(input)
form.append(hidden)
form.append(button)
modif.replaceWith(form);
});
};
let suppr = document.getElementsByClassName("tag-suppr");
for (const element of suppr) {
element.addEventListener('click', function ( e ) {
let confirm = window.confirm("Voulez vous supprimez ?");
let data = e.target.getAttribute("data-id");
if (confirm) {
window.location.href = "/tags/delete/" + data;
}
})
}
});