Skip to content
Snippets Groups Projects
Commit cae72a73 authored by Yannis Devos's avatar Yannis Devos
Browse files

Correction fonctionnement affichage des messages

parent 9d9f1655
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@WebServlet("/Welcome")
public class Feed extends HttpServlet {
......@@ -54,6 +55,15 @@ public class Feed extends HttpServlet {
MyThread msgThread = new MyThread(0,null);
if (!messages.isEmpty()) {
try {
Message msg = messages.get(0);
msgThread = threadDao.getThreadById(msg.getThreadId());
} catch (Exception e) {
throw new RuntimeException(e);
}
out.println("<h2 class=\"feedMsgThread\"> Thread : <span style=\"color : grey\">" + msgThread.getThreadName().toUpperCase() + "</span></h2>");
for (Message message : messages) {
try {
msgThread = threadDao.getThreadById(message.getThreadId());
......@@ -61,8 +71,7 @@ public class Feed extends HttpServlet {
throw new RuntimeException(e);
}
out.println("<div class=\"message\">");
out.println("<h3 class=\"msgThread\">" + msgThread.getThreadName() + "</h3>");
out.println("<p class=\"msgContent\">" + message.getContent() + "</p>");
out.println("<p class=\"msgContent\"><strong style=\"color : grey\">" + userDao.getUserById(message.getSenderId()).getUserName() + "</strong> : " + message.getContent() + "</p>");
boolean msgIsLiked = false;
try {
......@@ -72,7 +81,7 @@ public class Feed extends HttpServlet {
sqle.getStackTrace();
}
out.println("<form class=\"feedForm\" action=\"http://localhost:8080/s4a021-web-backend/LikeMessage\" method=\"post\">");
out.println("<form class=\"feedForm\" action=\"http://localhost:8080/s4a021-web-backend/LikeMessage\" method=\"post\">");
out.println("<input name=\"messageid\" type=\"hidden\" value=\"" + message.getMsgId() +"\">");
if (msgIsLiked) {
......@@ -90,7 +99,7 @@ public class Feed extends HttpServlet {
out.println("<form class=\"feedForm\" action=\"http://localhost:8080/s4a021-web-backend/PostMessage\" method=\"post\">");
out.println("<textarea name=\"message\" rows=\"2\" cols=\"30\" placeholder=\"Post a message in this thread\"></textarea>");
out.println("<input name=\"threadid\" type=\"hidden\" value=\"" + msgThread.getId() + "\">");
out.println("<button type=\"submit\">Post</button>");
out.println("<button class=\"postButton\" type=\"submit\">Post</button>");
out.println("</form>");
out.println("<div class=\"discover\">");
......
......@@ -74,7 +74,7 @@ public class Following extends HttpServlet {
}
else {
out.println("<h3>You are not following any thread yet.</h3>");
out.println("<button><a href=\"\">Discover new threads</a></button>");
out.println("<button><a href=\"http://localhost:8080/s4a021-web-backend/Discover\">Discover new threads</a></button>");
}
out.println("</body>");
......
......@@ -7,6 +7,14 @@ body{
background-color: #232323;
}
toCenter{
text-align: center;
}
.feedMsgThread{
margin-top : 5%;
}
.menu{
display: flex;
align-items: center;
......@@ -31,7 +39,7 @@ ul{
padding : 0;
}
form:not(.followThread, .feedForm) {
form:not(.followThread, .feedForm, .feedFormu) {
text-align: center;
display: flex;
flex-direction: column;
......@@ -41,6 +49,16 @@ form:not(.followThread, .feedForm) {
margin-top: 5%;
}
textarea{
margin-top : 1%;
margin-right : auto;
margin-left : auto;
}
postButton{
}
.menu_option{
text-align : center;
list-style: none;
......@@ -73,6 +91,7 @@ form>.link {
}
.discover{
margin-top : 5%;
text-align : center;
}
......@@ -83,7 +102,7 @@ form>.link {
}
.information{
margin-top : 10%;
margin-bottom : 2%;
margin-top : 5%;
margin-bottom : 5%;
text-align : center;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment