...
 
Commits (4)
......@@ -24,6 +24,17 @@
pointer-events: none;
}
#addNode {
visibility: hidden;
}
.draggable {
cursor: move;
}
#leTitre{
height: 100px;
}
......
function addCircleDraggable(){
var offset, x, y;
d3.select("g").append("circle")
.attr("r", 4.5)
.style('fill', function() { return color($('#type').val());})
.attr("class", "draggable")
.attr("id", "newNode")
.attr("cx", -20)
.attr("cy", -20)
.attr("transform", function() { return "translate(-200 -200)"; })
.call(d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended)
);
function dragstarted(d) {
x=+d3.event.x;
y=+d3.event.y;
d3.select(this).raise().classed("active", true);
offset=d3.event;
offset.x -= parseFloat(d3.select(this).attr("cx"));
offset.y -= parseFloat(d3.select(this).attr("cx"));
}
function dragged(d) {
console.log("start");
d3.select(this).attr("cx", d3.event.x - offset.x);
d3.select(this).attr("cy", d3.event.y - offset.y);
$(this).css({
'pointer-events' : 'none'
})
}
function dragended(d) {
console.log("ended");
d3.select(this).classed("active", false);
$(this).css({
'pointer-events' : 'auto'
})
}
d3.selectAll(".node").on("mouseover", handle)
function handle(d){
console.log("you", d);
selected=d;
$("#addNode").click();
}
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ function createGraph(data){
.parentId(function(d) { return d.parent; })
tree = d3.tree()
var tree = d3.tree()
.size([360, 500])
.separation(function(a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; });
......@@ -135,6 +135,11 @@ function createGraph(data){
/* === Ajout d'un noeud === */
$("#addCircle").click(function(){
addCircleDraggable();
});
var selected=null;
$("#addNode").click(function() {
......@@ -165,7 +170,7 @@ $("#addNode").click(function() {
dataType: 'text',
}).done(function(response) {
var newNodeObj = {
type: $("#type").val(),
name: $("#label").val(),
......@@ -383,6 +388,7 @@ function update(source) {
nodeEnter.append('circle')
.attr("r", 4.5)
.style('fill', function(d) {return color(d.data.type)})
.on('click', click)
.on("mouseover", handleMouseOver)
.on("mouseout", handleMouseOut);
......@@ -413,6 +419,12 @@ function update(source) {
}
}
......@@ -5,6 +5,7 @@
<link rel="stylesheet" type="text/css" href="/static/stylesheet/style.css">
<% include ../../partials/head %>
<title><%= title%></title>
</head>
<body>
<header>
......@@ -19,6 +20,7 @@
<div class="row">
<div id="colGauche" class="col-md-2">
<div class="container">
<div class="row">
<ul id="menuResume">
<li>
<label>Définitions :</label><br>
......@@ -27,6 +29,27 @@
<li>
<label>Sources :</label><br>
<h4><%= debate.sources%></h4>
<<<<<<< HEAD
</li>
</ul>
<br><br><hr><br><br>
</div>
<div class="row">
Choisir une date dans l'historique du débat :
<label>Date</label>
<input id="dateValue" type="date"><br>
</div>
<div class="row submit-row">
<button class="btn btn-block btn-primary submit-form" id="end" >Afficher</button>
</div>
</div>
<br>
=======
</li>
<li>
<label>Date :</label><br>
......@@ -39,6 +62,7 @@
</li>
</ul>
</div>
>>>>>>> d62efcb331eeffa432075af514f070ecbf13c66c
<!--
<table id="syntheses" class="table table-striped table-bordered">
<thead>
......@@ -75,6 +99,8 @@
<svg width="672" height="672"></svg>
</div>
<div id="colDroite" class="col-md-2">
<div class="container">
<button class="btn btn-block btn-primary" onClick="showHideContrib()">Contribuer</button>
......@@ -105,6 +131,9 @@
<div class="row submit-row">
<button class="btn btn-block btn-primary submit-form" id="addNode">Ajouter ma contribution</button>
</div>
<div class="row submit-row">
<button class="btn btn-block btn-primary submit-form" id="addCircle">Ajouter ma contribution</button>
</div>
</li>
</ul>
<button class="btn btn-block btn-primary" onClick="showHideSynth()">Synthétiser</button>
......@@ -131,19 +160,56 @@
</ul>
</div>
</div>
<div class="container">
<table id="syntheses" class="table table-striped table-bordered">
<thead>
<tr>
<th>Contributions synthétisées</th>
<th>Description</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% if(locals.syntheses) { %>
<% syntheses.forEach(function(synthese) { %>
<tr>
<td><%= synthese.contributions %></td>
<td><%= synthese.description %></td>
<td><%= synthese.timestamp %></td>
<td>
<form id="deleteSynthese/<%= synthese._id %>" method="POST" action="/syntheses/delete/<%= synthese._id %>"></form>
<a onClick="document.forms['deleteSynthese/<%= synthese._id %>'].submit()" class="btn btn-danger">
<i class="fas fa-trash-alt">
Delete
</i>
</a>
</td>
</tr>
<% }); %>
<% } %>
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript" src="/static/javascript/menuDebat.js"></script>
<script type="text/javascript" src="/static/javascript/jquery.min.js"></script>
<script>
<script>
var contributions = <%- JSON.stringify(contributions) %>;
const debate = <%- JSON.stringify(debate) %>;
</script>
<script type="text/javascript" src="/static/javascript/menuDebat.js"></script>
<script type="text/javascript" src="/static/javascript/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script type="text/javascript" src="/static/javascript/d3.v4.min.js"></script>
<script type="text/javascript" src="/static/javascript/radialTreeMap.js"></script>
<script type="text/javascript" src="/static/javascript/radialTreeMap.js"></script>
<script type="text/javascript" src="/static/javascript/dragndrop.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file