Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 889e17e4 authored by Pierre Jarriges's avatar Pierre Jarriges
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request !3
parents 70400240 9047ad7c
No related branches found
No related tags found
No related merge requests found
Showing
with 3349 additions and 771 deletions
"use strict";
const { fetch_all_articles } = require("../xhr");
class ArticleList {
constructor() {
this.state = {
articles: []
}
this.fetch_list();
}
fetch_list() {
fetch_all_articles()
.then(articles => {
this.state.articles = articles;
this.refresh_list();
})
.catch(err => console.log(err))
}
refresh_list() {
obj2htm.subRender(this.render_list(), document.getElementById("browse-articles-results"), { mode: "replace" })
}
render_list() {
return {
tag: "ul",
id: "browse-articles-results",
contents: this.state.articles.map(art => {
return { tag: "li", contents: `[${art.locale}] <b>${art.title}</b> - ${art._id.$oid}` };
}),
}
}
render() {
return {
tag: "div",
contents: [
{ tag: "button", onclick: this.fetch_list.bind(this), contents: "REFRESH" },
this.render_list()
],
}
}
}
module.exports = ArticleList;
\ No newline at end of file
const CreateArticleForm = require("./create-article-form");
const UpdateArticleForm = require("./update-article-form");
const ArticleList = require("./articles-list");
class RootComponent {
constructor() {
......@@ -20,6 +21,8 @@ class RootComponent {
return new CreateArticleForm().render();
case "update":
return new UpdateArticleForm().render();
case "browse":
return new ArticleList().render();
default:
return undefined;
}
......@@ -43,6 +46,11 @@ class RootComponent {
class: this.state.selected_tab === "update" ? "selected" : "",
onclick: this.handle_nav_click.bind(this),
},
{
tag: "span", contents: "Browse articles", tab_name: "browse",
class: this.state.selected_tab === "browse" ? "selected" : "",
onclick: this.handle_nav_click.bind(this),
},
],
},
this.render_state(),
......
......@@ -107,6 +107,22 @@ async function fetch_delete_article(article_id) {
});
}
async function fetch_all_articles() {
return new Promise((resolve, reject) => {
fetch(`/articles`)
.then(async res => {
if (res.status >= 400 && res.status < 600) {
const text = await res.text();
reject(text)
} else {
const json = await res.json();
resolve(json);
}
})
.catch(err => reject(err))
});
}
module.exports = {
fetch_article,
......@@ -115,4 +131,5 @@ module.exports = {
fetch_post_article,
fetch_update_article,
fetch_delete_article,
fetch_all_articles,
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File deleted
File deleted
public/assets/images/home-sweet-home-forest.png

21.5 KiB

public/assets/images/screen-home-sweet-home-chalet.png

53.6 KiB

public/assets/images/screen-home-sweet-home-forest.png

73.8 KiB

......@@ -8,7 +8,8 @@ module.exports = {
},{}],2:[function(require,module,exports){
module.exports = {
images_url: `/assets/images/`,
images_url: `/assets/images`,
data_url: `/assets/data`,
};
},{}],3:[function(require,module,exports){
......@@ -318,7 +319,7 @@ class EducationPage extends WebPage {
{
tag: "img",
alt: "image brain",
src: `${images_url}brain.svg`,
src: `${images_url}/brain.svg`,
},
],
},
......@@ -352,7 +353,7 @@ class EducationPage extends WebPage {
tag: "li",
class: "edu-theme",
contents: [
{ tag: "img", width: 250, height: 140, class: "pixelated", src: `${images_url}${theme.image}` },
{ tag: "img", width: 250, height: 140, class: "pixelated", src: `${images_url}/${theme.image}` },
{ tag: "h3", contents: theme.title },
{ tag: "p", contents: theme.description },
]
......@@ -614,13 +615,13 @@ class NavBar {
{
tag: "img",
alt: "Logo Kuadrado",
src: `${images_url}logo_kuadrado.svg`,
src: `${images_url}/logo_kuadrado.svg`,
},
{
tag: "img",
alt: "Kuadrado Software",
class: "logo-text",
src: `${images_url}logo_kuadrado_txt.svg`,
src: `${images_url}/logo_kuadrado_txt.svg`,
},
],
},
......@@ -719,13 +720,13 @@ class Template {
{
tag: "img",
alt: `logo Kuadrado`,
src: `${images_url}logo_kuadrado.svg`,
src: `${images_url}/logo_kuadrado.svg`,
},
{
tag: "img",
class: "text-logo",
alt: "Kuadrado Software",
src: `${images_url}logo_kuadrado_txt.svg`,
src: `${images_url}/logo_kuadrado_txt.svg`,
},
],
},
......
This diff is collapsed.
This diff is collapsed.
......@@ -12,7 +12,8 @@ module.exports = {
},{}],3:[function(require,module,exports){
module.exports = {
images_url: `/assets/images/`,
images_url: `/assets/images`,
data_url: `/assets/data`,
};
},{}],4:[function(require,module,exports){
......@@ -479,7 +480,7 @@ class SoftwareDevelopment extends WebPage {
{
tag: "img",
alt: `image mechanic electronic`,
src: `${images_url}meca_proc.svg`,
src: `${images_url}/meca_proc.svg`,
},
],
},
......@@ -571,13 +572,13 @@ class NavBar {
{
tag: "img",
alt: "Logo Kuadrado",
src: `${images_url}logo_kuadrado.svg`,
src: `${images_url}/logo_kuadrado.svg`,
},
{
tag: "img",
alt: "Kuadrado Software",
class: "logo-text",
src: `${images_url}logo_kuadrado_txt.svg`,
src: `${images_url}/logo_kuadrado_txt.svg`,
},
],
},
......@@ -676,13 +677,13 @@ class Template {
{
tag: "img",
alt: `logo Kuadrado`,
src: `${images_url}logo_kuadrado.svg`,
src: `${images_url}/logo_kuadrado.svg`,
},
{
tag: "img",
class: "text-logo",
alt: "Kuadrado Software",
src: `${images_url}logo_kuadrado_txt.svg`,
src: `${images_url}/logo_kuadrado_txt.svg`,
},
],
},
......
......@@ -80,8 +80,9 @@ main .image-carousel {
}
main .image-carousel img {
position: absolute;
object-fit: contain;
height: 80%;
max-width: 100%;
max-height: 400px;
}
main .image-carousel .carousel-bullets {
position: absolute;
......@@ -102,9 +103,6 @@ main .image-carousel .carousel-bullets .bullet.active {
background-color: #d4d9dd;
}
@media screen and (max-width: 900px) {
main .image-carousel img {
max-height: 100%;
}
main .image-carousel .carousel-bullets {
gap: 30px;
}
......@@ -479,174 +477,6 @@ main #page-container #home-page .page-header .philo-bubbles li:last-child {
main #page-container #home-page .page-header .philo-bubbles li:last-child * {
color: #96a5ae;
}
main #page-container #home-page #news {
padding: 60px 20px;
}
main #page-container #home-page #news .articles-displayer {
margin: 0 auto 40px;
}
main #page-container #home-page #news .articles-displayer .prev-next-buttons {
display: flex;
justify-content: space-between;
}
main #page-container #home-page #news .articles-displayer .prev-next-buttons .prev-btn,
main #page-container #home-page #news .articles-displayer .prev-next-buttons .next-btn {
border: none;
background: none;
display: flex;
align-items: center;
gap: 10px;
padding: 5px 0;
}
main #page-container #home-page #news .articles-displayer .prev-next-buttons .prev-btn.disabled,
main #page-container #home-page #news .articles-displayer .prev-next-buttons .next-btn.disabled {
visibility: hidden;
pointer-events: none;
}
main #page-container #home-page #news .articles-displayer .prev-next-buttons .prev-btn.active,
main #page-container #home-page #news .articles-displayer .prev-next-buttons .next-btn.active {
cursor: pointer;
color: #6b7880;
}
main #page-container #home-page #news .articles-displayer .prev-next-buttons .prev-btn.active:hover,
main #page-container #home-page #news .articles-displayer .prev-next-buttons .next-btn.active:hover {
color: #3c4144;
}
main #page-container #home-page #news .articles-displayer .prev-next-buttons .next-btn.active::after {
content: " ";
border-style: solid;
border-width: 2px 2px 0 0;
width: 8px;
height: 8px;
transform: rotate(45deg);
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
}
main #page-container #home-page #news .articles-displayer .prev-next-buttons .prev-btn.active::before {
content: " ";
border-style: solid;
border-width: 2px 2px 0 0;
width: 8px;
height: 8px;
transform: rotate(-135deg);
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
}
main #page-container #home-page #news .articles-displayer article {
display: grid;
gap: 5px 50px;
grid-template-rows: auto auto auto 1fr;
position: relative;
padding-left: 20px;
}
main #page-container #home-page #news .articles-displayer article.grid-1 {
grid-template-columns: 1fr;
}
main #page-container #home-page #news .articles-displayer article.grid-2 {
grid-template-columns: 1fr 1fr;
}
main #page-container #home-page #news .articles-displayer article .date {
grid-column: 1;
grid-row: 1;
text-align: right;
}
main #page-container #home-page #news .articles-displayer article .date time {
color: #6b7880;
font-style: italic;
font-size: 12px;
}
main #page-container #home-page #news .articles-displayer article .title {
grid-column: 1;
grid-row: 2;
}
main #page-container #home-page #news .articles-displayer article .title h3 {
margin: 0 0 10px;
}
main #page-container #home-page #news .articles-displayer article .subtitle {
grid-column: 1;
grid-row: 3;
font-style: italic;
font-size: 15px;
}
main #page-container #home-page #news .articles-displayer article .body {
grid-column: 1;
grid-row: 4;
min-height: 200px;
padding-bottom: 40px;
text-align: justify;
}
main #page-container #home-page #news .articles-displayer article .image-carousel {
grid-row: 1/span 4;
grid-column: 2;
}
main #page-container #home-page #news .articles-displayer article .image-carousel img {
max-height: 100%;
}
main #page-container #home-page #news .articles-displayer article.article-placeholder {
padding: 0;
}
main #page-container #home-page #news .articles-displayer article.article-placeholder * {
background-color: #d4d9dd;
}
main #page-container #home-page #news .articles-displayer article.article-placeholder .date {
height: 10px;
}
main #page-container #home-page #news .articles-displayer article.article-placeholder .title {
height: 40px;
}
main #page-container #home-page #news .articles-displayer article.article-placeholder .subtitle {
height: 30px;
}
@media screen and (max-width: 900px) {
main #page-container #home-page #news .articles-displayer article {
gap: 5px;
padding: 0;
}
main #page-container #home-page #news .articles-displayer article.grid-2 {
grid-template-columns: 1fr;
grid-template-rows: 300px auto auto auto 1fr;
}
main #page-container #home-page #news .articles-displayer article.grid-2 .date {
grid-row: 2;
}
main #page-container #home-page #news .articles-displayer article.grid-2 .title {
grid-row: 3;
}
main #page-container #home-page #news .articles-displayer article.grid-2 .subtitle {
grid-row: 4;
}
main #page-container #home-page #news .articles-displayer article.grid-2 .body {
grid-row: 5;
}
main #page-container #home-page #news .articles-displayer article.grid-2 .image-carousel {
grid-row: 1;
grid-column: 1;
}
main #page-container #home-page #news .articles-displayer article.grid-1 .date {
grid-row: 1;
}
main #page-container #home-page #news .articles-displayer article.grid-1 .title {
grid-row: 2;
}
main #page-container #home-page #news .articles-displayer article.grid-1 .subtitle {
grid-row: 3;
}
main #page-container #home-page #news .articles-displayer article.grid-1 .body {
grid-row: 4;
}
main #page-container #home-page #news .articles-displayer article .date,
main #page-container #home-page #news .articles-displayer article .title,
main #page-container #home-page #news .articles-displayer article .subtitle {
padding: 0 10px;
}
main #page-container #home-page #news .articles-displayer article .body {
padding: 0 10px 30px;
}
}
main #page-container #home-page .poles {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
......@@ -731,83 +561,6 @@ main #page-container #home-page .kuadrado-values ul.values-list li h3 {
main #page-container #home-page .kuadrado-values ul.values-list li p {
text-align: justify;
}
main #page-container #home-page #whoami {
padding: 20px 0 50px;
}
main #page-container #home-page #whoami .page-contents-center {
padding: 40px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
flex-direction: column;
}
main #page-container #home-page #whoami .page-contents-center h2 {
text-align: center;
background-color: #6b7880;
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
flex-direction: column;
width: 220px;
height: 220px;
border-radius: 100%;
padding: 30px;
margin: 40px 0;
color: #72e3f0;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .header {
display: grid;
grid-template-columns: auto 1fr;
gap: 30px;
padding: 50px 0;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .header .pic {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
flex-direction: column;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .header .pic img {
width: 150px;
height: auto;
border-radius: 100%;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .header .header-text h3 {
font-size: 22px;
color: #96a5ae;
margin: 0;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .header .header-text h4 {
font-size: 18px;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .header .header-text strong,
main #page-container #home-page #whoami .page-contents-center .presentation-card .header .header-text h4 {
color: #96a5ae;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .body p {
font-size: 18px;
font-style: italic;
font-family: serif;
color: #555d61;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .body p *:not(blue, a) {
color: #555d61;
}
@media screen and (max-width: 560px) {
main #page-container #home-page #whoami .page-contents-center .presentation-card .header {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
flex-direction: column;
}
main #page-container #home-page #whoami .page-contents-center .presentation-card .header .header-text {
text-align: center;
}
}
@media screen and (max-width: 900px) {
main #page-container #home-page .poles {
grid-template-columns: 1fr;
......@@ -1062,7 +815,7 @@ main #page-container #games-page .game-articles article.game-article .game-descr
main #page-container #games-page .game-articles article.game-article .image-carousel {
grid-column: 2;
grid-row: 3/span 4;
height: 100%;
height: 400px;
}
main #page-container #games-page .game-articles article.placeholder {
height: 400px;
......@@ -1090,10 +843,20 @@ main #page-container #games-page .game-articles article.placeholder * {
main #page-container #games-page .game-articles article.game-article .image-carousel {
grid-column: 1;
grid-row: 3;
height: 400px;
margin: 0 -20px;
}
}
main #page-container #games-page .game-articles article .play-button {
border: none;
background-color: unset;
font-weight: bold;
font-size: 20px;
cursor: pointer;
color: #4baabb;
}
main #page-container #games-page .game-articles article .play-button:hover {
color: #72e3f0;
}
main #page-container #software-page .software-articles {
margin: 20px auto 50px;
}
......
......@@ -89,6 +89,7 @@ async fn main() -> std::io::Result<()> {
.service(get_articles_by_category)
.service(get_article)
.service(get_article_by_title)
.service(get_all_articles)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// STANDARD FILES ///////////////////////////////////////////////////////////////////////////////////////////
.service(resource("/favicon.ico").route(get().to(favicon)))
......
......@@ -175,6 +175,27 @@ pub async fn get_article_by_title(
}
}
#[get("/articles")]
pub async fn get_all_articles(app_state: Data<AppState>) -> impl Responder {
match get_collection(&app_state).find(None, None).await {
Ok(mut cursor) => {
let mut results: Vec<Article> = Vec::new();
while let Some(result) = cursor.next().await {
match result {
Ok(article) => {
results.push(article);
}
Err(_) => {
return HttpResponse::InternalServerError().finish();
}
}
}
HttpResponse::Ok().json(results)
}
Err(_) => HttpResponse::InternalServerError().finish(),
}
}
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*@@
*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*@@
* _______ ______ ______ _______ *@@
......
module.exports = {
images_url: `/assets/images/`,
images_url: `/assets/images`,
data_url: `/assets/data`,
};
......@@ -9,6 +9,7 @@
"version": "1.0.3",
"license": "MIT",
"dependencies": {
"mentalo-engine": "0.1.17",
"object-to-html-renderer": "^1.1.1"
},
"devDependencies": {
......@@ -1165,6 +1166,12 @@
"safe-buffer": "^5.1.2"
}
},
"node_modules/mentalo-engine": {
"version": "0.1.17",
"resolved": "https://registry.npmjs.org/mentalo-engine/-/mentalo-engine-0.1.17.tgz",
"integrity": "sha512-y3t+tCuS6imPeBfcQJcvDU1zn/DEn8Roszc21PdkiZaP89tpg5h9a2pOEy6eN3oZF3EoLD+PSgYn1eOAzjuIQA==",
"license": "GPL-3.0"
},
"node_modules/miller-rabin": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz",
......@@ -2928,6 +2935,11 @@
"safe-buffer": "^5.1.2"
}
},
"mentalo-engine": {
"version": "0.1.17",
"resolved": "https://registry.npmjs.org/mentalo-engine/-/mentalo-engine-0.1.17.tgz",
"integrity": "sha512-y3t+tCuS6imPeBfcQJcvDU1zn/DEn8Roszc21PdkiZaP89tpg5h9a2pOEy6eN3oZF3EoLD+PSgYn1eOAzjuIQA=="
},
"miller-rabin": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz",
......
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