mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
Affiche un texte par défaut, et propose une popup pour saisi
Base de fonctionnement sans javascript
This commit is contained in:
parent
23902aca1f
commit
053d24c158
28
public/name_form.html
Normal file
28
public/name_form.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="referrer" content="same-origin">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Framadate</title>
|
||||
|
||||
<meta name="description" content=" ">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link crossorigin="anonymous" rel="stylesheet" href="https://rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap-reboot.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<form>
|
||||
<label>Nom :
|
||||
<input type="text" name="name" placeholder="Bob"/>
|
||||
</label>
|
||||
<button type="submit">Valider</button>
|
||||
<p class="example">Par exemple : Stéphane ou Caroline</p>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -19,17 +19,17 @@
|
||||
|
||||
<section>
|
||||
<p>
|
||||
Je m'appelle <input name="nom">
|
||||
Je m'appelle <a href="name_form.html" id="name">henri</a>
|
||||
et le titre de ce sondage
|
||||
<select id="type_sondage">
|
||||
<option>classique</option>
|
||||
<option>special dates</option>
|
||||
</select>
|
||||
est <input name="titre">.
|
||||
est <input type="text" name="titre">.
|
||||
</p>
|
||||
<p>
|
||||
Si je devais le décrire pour les autres personnes, je dirais
|
||||
<textarea></textarea>
|
||||
<textarea></textarea>.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
@ -1,3 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const $ = selector => document.querySelector(selector)
|
||||
const $$ = selector => document.querySelectorAll(selector)
|
||||
|
||||
const debugStorage = () => {
|
||||
for(var i = 0; i < localStorage.length; i++) {
|
||||
let key = localStorage.key(i)
|
||||
@ -5,7 +10,30 @@ const debugStorage = () => {
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelectorAll('input').forEach((inputElement) => {
|
||||
var nameFieldLink = $("#name").addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
console.log("click sur le name");
|
||||
createModal("truc");
|
||||
});
|
||||
|
||||
const removeOverlay = () => {
|
||||
$('body').removeChild($('.overlay'))
|
||||
}
|
||||
|
||||
const createModal = (text) => {
|
||||
const overlay = document.createElement('div')
|
||||
const popin = document.createElement('div')
|
||||
|
||||
popin.innerHTML = text
|
||||
popin.className = 'modal'
|
||||
overlay.className = 'overlay'
|
||||
overlay.appendChild(popin)
|
||||
overlay.addEventListener('click', removeOverlay)
|
||||
$('body').insertBefore(overlay, $('main'))
|
||||
}
|
||||
|
||||
|
||||
$$('input').forEach((inputElement) => {
|
||||
inputElement.addEventListener("change", () => {
|
||||
localStorage[inputElement.name] = inputElement.value
|
||||
});
|
||||
@ -16,10 +44,10 @@ if(document.getElementById("type_sondage")) {
|
||||
let typeSondage = this.options[this.selectedIndex].text;
|
||||
if(typeSondage == "classique") {
|
||||
localStorage.setItem('type_sondage', this.options[this.selectedIndex].text);
|
||||
document.querySelector('#next').href = "reponses.html";
|
||||
$('#next').href = "reponses.html";
|
||||
} else {
|
||||
localStorage.setItem('type_sondage', 'dates');
|
||||
document.querySelector('#next').href = "dates.html";
|
||||
$('#next').href = "dates.html";
|
||||
}
|
||||
debugStorage()
|
||||
})
|
||||
|
@ -43,3 +43,25 @@ input[type="text"], input[type="email"] {
|
||||
line-height:60%;
|
||||
}
|
||||
|
||||
.toggle-field {
|
||||
color: blue;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
background: rgba(1, 1, 1, .3);
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: 5;
|
||||
}
|
||||
.modal {
|
||||
background: #fff;
|
||||
top: 10%;
|
||||
left: 40%;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user