From 3f91497ee6df6096f585d286179313ace0890329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Franco=20S=C3=A1nchez?= <56022165+pabfrasan@users.noreply.github.com> Date: Thu, 15 Apr 2021 21:50:02 +0200 Subject: [PATCH 1/2] =?UTF-8?q?A=C3=B1adido=20las=20estrellas=20a=20las=20?= =?UTF-8?q?rese=C3=B1as?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../springframework/cheapy/model/Client.java | 7 ---- src/main/less/cheapy.less | 1 + src/main/less/starRating.less | 40 +++++++++++++++++++ .../jsp/reviews/createOrUpdateReviewForm.jsp | 3 +- .../WEB-INF/jsp/reviews/reviewsList.jsp | 8 +++- .../WEB-INF/jsp/reviews/reviewsShow.jsp | 9 +++-- src/main/webapp/WEB-INF/tags/ratingStar.tag | 37 +++++++++++++++++ src/main/webapp/WEB-INF/tags/showStars.tag | 18 +++++++++ 8 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 src/main/less/starRating.less create mode 100644 src/main/webapp/WEB-INF/tags/ratingStar.tag create mode 100644 src/main/webapp/WEB-INF/tags/showStars.tag diff --git a/src/main/java/org/springframework/cheapy/model/Client.java b/src/main/java/org/springframework/cheapy/model/Client.java index e9f56687d..6f4533166 100644 --- a/src/main/java/org/springframework/cheapy/model/Client.java +++ b/src/main/java/org/springframework/cheapy/model/Client.java @@ -145,13 +145,6 @@ public class Client extends BaseEntity { this.description = description; } - public Municipio getMunicipio() { - return municipio; - } - - public void setMunicipio(Municipio municipio) { - this.municipio = municipio; - } public Code getCode() { return cod; diff --git a/src/main/less/cheapy.less b/src/main/less/cheapy.less index a6a211767..6e05e3f98 100644 --- a/src/main/less/cheapy.less +++ b/src/main/less/cheapy.less @@ -642,3 +642,4 @@ hr { @import "typography.less"; @import "header.less"; @import "responsive.less"; +@import "starRating.less" diff --git a/src/main/less/starRating.less b/src/main/less/starRating.less new file mode 100644 index 000000000..0cf338fc6 --- /dev/null +++ b/src/main/less/starRating.less @@ -0,0 +1,40 @@ +.rating { + display: flex; + flex-direction: row-reverse; + justify-content: flex-end + } + + .rating>input { + display: none + } + + .rating>label { + position: relative; + width: 1em; + font-size: 200%; + color: #FFD600; + cursor: pointer + } + + .rating>label::before { + content: "\2605"; + position: absolute; + opacity: 0 + } + + .rating>label:hover:before, + .rating>label:hover~label:before { + opacity: 1 !important + } + + .rating>input:checked~label:before { + opacity: 1 + } + + .rating:hover>input:checked~label:before { + opacity: 0.4 + } + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp b/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp index 93f628af0..ac2b3af7a 100644 --- a/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/reviews/createOrUpdateReviewForm.jsp @@ -14,7 +14,8 @@
- + +
diff --git a/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp b/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp index 394e6fbbe..da8323d41 100644 --- a/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp +++ b/src/main/webapp/WEB-INF/jsp/reviews/reviewsList.jsp @@ -4,6 +4,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> @@ -26,6 +27,7 @@ + <%-- --%> @@ -34,7 +36,10 @@ - + + + + @@ -51,6 +56,7 @@ + diff --git a/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp b/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp index b13c31115..bfbf2c3d1 100644 --- a/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp +++ b/src/main/webapp/WEB-INF/jsp/reviews/reviewsShow.jsp @@ -6,25 +6,28 @@ <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

+ - + + - +
- +
diff --git a/src/main/webapp/WEB-INF/tags/ratingStar.tag b/src/main/webapp/WEB-INF/tags/ratingStar.tag new file mode 100644 index 000000000..6d6bcb83d --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/ratingStar.tag @@ -0,0 +1,37 @@ +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> +<%@ attribute name="name" required="true" rtexprvalue="true" + description="Name of corresponding property in bean object" %> +<%@ attribute name="disabled" required="false" rtexprvalue="true" + description="Disable the input" %> +<%@ attribute name="label" required="true" rtexprvalue="true" + description="Label appears in red color if input is considered as invalid after submission" %> +<%@ attribute name="placeholder" required="false" rtexprvalue="true" + description="Example for input field" %> + + + + +
+ + + +
+
+ + + + + + +
+ + + + ${status.errorMessage} + +
+
+
diff --git a/src/main/webapp/WEB-INF/tags/showStars.tag b/src/main/webapp/WEB-INF/tags/showStars.tag new file mode 100644 index 000000000..f68844d5c --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/showStars.tag @@ -0,0 +1,18 @@ +<%@tag import="com.sun.org.apache.xalan.internal.xsltc.compiler.sym"%> +<%@ tag language="java" pageEncoding="ISO-8859-1"%> +<%@ attribute name="value" required="true" rtexprvalue="true" type="Integer" + description="Number of starts" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +
+ + +
+ /> + /> + /> + /> + /> +
+ +
From b4bcec89d5c34569bde1523c20adaa5895c6e698 Mon Sep 17 00:00:00 2001 From: "gabgutpri@alum.us.es" Date: Fri, 16 Apr 2021 12:20:47 +0200 Subject: [PATCH 2/2] Solucionado buscar sin municipio --- .../cheapy/web/OfertaController.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/springframework/cheapy/web/OfertaController.java b/src/main/java/org/springframework/cheapy/web/OfertaController.java index 81fdae55e..e203cc1c3 100644 --- a/src/main/java/org/springframework/cheapy/web/OfertaController.java +++ b/src/main/java/org/springframework/cheapy/web/OfertaController.java @@ -2,7 +2,6 @@ package org.springframework.cheapy.web; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -114,6 +113,17 @@ public class OfertaController { @GetMapping("/offersByPlace") public String processFindFormByPlace(final Map model, final HttpServletRequest request) { + + if (request.getParameter("municipio").equals("") || request.getParameter("municipio").equals(null)) { + // AƱade la lista de municipios al desplegable + model.put("municipios", Municipio.values()); + + //Se aƱade formateador de fecha al modelo + model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")); + + return "redirect:/offers/"; + } + Municipio mun = Municipio.valueOf(request.getParameter("municipio")); List foodOfferLs = this.foodOfferService.findFoodOfferByClientPlace(mun); @@ -161,30 +171,30 @@ public class OfertaController { return "offers/offersCreate"; } - + @GetMapping("/offersRecord") public String processOffersRecordForm(final Map model) { - + Pageable p = PageRequest.of(0, 3); - + Map datos = new HashMap(); - - for(Offer of:this.foodOfferService.findAllFoodOffer(p)) { + + for (Offer of : this.foodOfferService.findAllFoodOffer(p)) { datos.put(of, "food"); } - - for(Offer of:this.nuOfferService.findAllNuOffer(p)) { + + for (Offer of : this.nuOfferService.findAllNuOffer(p)) { datos.put(of, "nu"); } - - for(Offer of:this.speedOfferService.findAllSpeedOffer(p)) { + + for (Offer of : this.speedOfferService.findAllSpeedOffer(p)) { datos.put(of, "speed"); } - - for(Offer of:this.timeOfferService.findAllTimeOffer(p)) { + + for (Offer of : this.timeOfferService.findAllTimeOffer(p)) { datos.put(of, "time"); } - + model.put("datos", datos); //Se aƱade formateador de fecha al modelo @@ -192,7 +202,7 @@ public class OfertaController { return "offers/offersRecordList"; } - + // @GetMapping("/owners/{ownerId}/edit") // public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) { // Owner owner = this.ownerService.findOwnerById(ownerId);