Implement message for info
This commit is contained in:
parent
230d71944f
commit
96e8b19f41
@ -1,5 +1,6 @@
|
|||||||
package org.hso.ecommerce.app;
|
package org.hso.ecommerce.app;
|
||||||
|
|
||||||
|
import org.hso.ecommerce.components.InfoDemoInterceptor;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
@ -15,5 +16,6 @@ public class Config implements WebMvcConfigurer {
|
|||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry.addInterceptor(new LoginIntercepter());
|
registry.addInterceptor(new LoginIntercepter());
|
||||||
registry.addInterceptor(new ErrorDemoInterceptor());
|
registry.addInterceptor(new ErrorDemoInterceptor());
|
||||||
|
registry.addInterceptor(new InfoDemoInterceptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package org.hso.ecommerce.components;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class InfoDemoInterceptor implements HandlerInterceptor {
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(
|
||||||
|
HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
|
|
||||||
|
request.setAttribute("info", request.getParameter("info"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void postHandle(
|
||||||
|
HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||||
|
ModelAndView modelAndView) throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
|
||||||
|
Object handler, Exception exception) throws Exception {}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package org.hso.ecommerce.contoller;
|
|||||||
import org.hso.ecommerce.db.CustomerRepository;
|
import org.hso.ecommerce.db.CustomerRepository;
|
||||||
import org.hso.ecommerce.entities.Customer;
|
import org.hso.ecommerce.entities.Customer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -765,6 +765,12 @@ input[type="number"]:focus {
|
|||||||
font-size: var(--u0);
|
font-size: var(--u0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
background-color: var(--c-secondary);
|
||||||
|
text-align: center;
|
||||||
|
font-size: var(--u0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Impov
|
* Impov
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +40,21 @@
|
|||||||
<a class="secondary button error" href="javascript:void(0)" onclick="toggle('error-msg');">X</a>
|
<a class="secondary button error" href="javascript:void(0)" onclick="toggle('error-msg');">X</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div th:if="${info}" class="info" id="info-msg">
|
||||||
|
<div class="content-width bar-flex">
|
||||||
|
<div th:text="${info}" class="spacer info">
|
||||||
|
Info
|
||||||
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<script>
|
||||||
|
function toggle(id) {
|
||||||
|
document.getElementById(id).classList.toggle("invisible");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<a class="secondary button info" href="javascript:void(0)" onclick="toggle('info-msg');">X</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</body>
|
</body>
|
||||||
|
Reference in New Issue
Block a user