Merge branch 'Olivier'
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -8,7 +8,7 @@ build/
|
|||||||
### STS ###
|
### STS ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
.classpath
|
.classpath
|
||||||
.log
|
*.log
|
||||||
.factorypath
|
.factorypath
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
package fr.eni.enchere.bll;
|
package fr.eni.enchere.bll;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
@Service
|
||||||
public class FileService {
|
public class FileService {
|
||||||
|
|
||||||
public boolean fileExists(String filePath) {
|
public boolean fileExists(String filePath) {
|
||||||
return Files.exists(Paths.get(filePath));
|
return Files.exists(Paths.get("src/main/resources/static"+filePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// src/main/resources/static/images/articles/12.jpg
|
||||||
@@ -76,8 +76,9 @@ public class AccueilController {
|
|||||||
|
|
||||||
// Pagination
|
// Pagination
|
||||||
Page<Article> articlePage = articleService.searchArticlePageable(critere, PageRequest.of(page, size));
|
Page<Article> articlePage = articleService.searchArticlePageable(critere, PageRequest.of(page, size));
|
||||||
model.addAttribute("articles", articlePage.getContent());
|
|
||||||
|
|
||||||
|
model.addAttribute("articles", articlePage.getContent());
|
||||||
|
model.addAttribute("fileService", fileService);
|
||||||
int currentPage = page + 1;
|
int currentPage = page + 1;
|
||||||
model.addAttribute("currentPage", currentPage);
|
model.addAttribute("currentPage", currentPage);
|
||||||
model.addAttribute("critere", critere);
|
model.addAttribute("critere", critere);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ article.details.label.amount = Montant
|
|||||||
article.details.button.bid = Ench\u00E9rir
|
article.details.button.bid = Ench\u00E9rir
|
||||||
article.details.address.unknown = Adresse inconnue
|
article.details.address.unknown = Adresse inconnue
|
||||||
article.details.validation.amount.required = Le montant de l'ench\u00E8re est requis.
|
article.details.validation.amount.required = Le montant de l'ench\u00E8re est requis.
|
||||||
article.details.retrait = Retrait effectu\u00E8
|
article.details.retrait = Retrait effectu\u00E9
|
||||||
|
|
||||||
|
|
||||||
edit.article.title = Modifier mon article
|
edit.article.title = Modifier mon article
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
<div class="card shadow-sm h-100 card-article">
|
<div class="card shadow-sm h-100 card-article">
|
||||||
<div class="row g-0">
|
<div class="row g-0">
|
||||||
<div class="col-md-4 d-flex align-items-center justify-content-center p-3">
|
<div class="col-md-4 d-flex align-items-center justify-content-center p-3">
|
||||||
<img th:if="${fileService.fileExists('/images/articles/' + article.id + '.jpg')}" th:src="@{/images/articles/{id}(id=${article.id})}" alt="Image de l'article" class="img-fluid rounded">
|
<img th:if="${fileService.fileExists('/images/articles/' + article.id + '.jpg')}" th:src="'images/articles/' + ${article.id} + '.jpg'" alt="Image de l'article" class="img-fluid rounded">
|
||||||
<img th:unless="${fileService.fileExists('/images/articles/' + article.id + '.jpg')}" th:src="@{/images/articles/no-data.jpg}" alt="Image de l'article" class="img-fluid rounded">
|
<img th:unless="${fileService.fileExists('/images/articles/' + article.id + '.jpg')}" th:src="@{/images/articles/no-data.jpg}" alt="Image de l'article" class="img-fluid rounded">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user