From 647e0a8b5b42448ec35dcbf280fae21bd8520539 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 23 Apr 2020 19:55:47 +0200 Subject: [PATCH] Blog 2.0 personnalisation image de couverture EN COURS --- core/module/install/ressource/defaultdata.php | 9 +++-- module/blog/blog.php | 20 +++++++++- module/blog/view/article/article.css | 40 ++++++++++++++++--- module/blog/view/article/article.php | 8 ++-- module/blog/view/edit/edit.php | 21 ++++++++-- module/blog/view/index/index.css | 19 +++++++-- module/blog/view/index/index.php | 5 +-- 7 files changed, 99 insertions(+), 23 deletions(-) diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 8160ebe7..60c3a05f 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -504,7 +504,8 @@ class init extends common { ], 'content' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In a placerat metus. Morbi luctus laoreet dolor et euismod. Phasellus eget eros ac eros pretium tincidunt. Sed maximus magna lectus, non vestibulum sapien pretium maximus. Donec convallis leo tortor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras convallis lacus eu risus gravida varius. Etiam mattis massa vitae eros placerat bibendum.

Vivamus tempus magna augue, in bibendum quam blandit at. Morbi felis tortor, suscipit ut ipsum ut, volutpat consectetur orci. Nulla tincidunt quis ligula non viverra. Sed pretium dictum blandit. Donec fringilla, nunc at dictum pretium, arcu massa viverra leo, et porta turpis ipsum eget risus. Quisque quis maximus purus, in elementum arcu. Donec nisi orci, aliquam non luctus non, congue volutpat massa. Curabitur sed risus congue, porta arcu vel, tincidunt nisi. Duis tincidunt quam ut velit maximus ornare. Nullam sagittis, ante quis pharetra hendrerit, lorem massa dapibus mi, a hendrerit dolor odio nec augue. Nunc sem nisl, tincidunt vitae nunc et, viverra tristique diam. In eget dignissim lectus. Nullam volutpat lacus id ex dapibus viverra. Pellentesque ultricies lorem ut nunc elementum volutpat. Cras id ultrices justo.

Phasellus nec erat leo. Praesent at sem nunc. Vestibulum quis condimentum turpis. Cras semper diam vitae enim fringilla, ut fringilla mauris efficitur. In nec porttitor urna. Nam eros leo, vehicula eget lobortis sed, gravida id mauris. Nulla bibendum nunc tortor, non bibendum justo consectetur vel. Phasellus nec risus diam. In commodo tellus nec nulla fringilla, nec feugiat nunc consectetur. Etiam non eros sodales, sodales lacus vel, finibus leo. Quisque hendrerit tristique congue. Phasellus nec augue vitae libero elementum facilisis. Mauris pretium ornare nisi, non scelerisque velit consectetur sit amet.

', 'picture' => 'galerie/landscape/meadow.jpg', - 'hidePicture' => false, + 'hidePicture' => false, + 'pictureSize' => 20, 'publishedOn' => 1548790902, 'state' => true, 'title' => 'Mon premier article', @@ -515,7 +516,8 @@ class init extends common { 'comment' => [], 'content' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam lobortis eros pharetra metus rutrum pretium et sagittis mauris. Donec commodo venenatis sem nec suscipit. In tempor sollicitudin scelerisque. Etiam quis nibh eleifend, congue nisl quis, ultricies ipsum. Integer at est a eros vulputate pellentesque eu vitae tellus. Nullam suscipit quam nisl. Vivamus dui odio, luctus ac fringilla ultrices, eleifend vel sapien. Integer sem ex, lobortis eu mattis eu, condimentum non libero. Aliquam non porttitor elit, eu hendrerit neque. Praesent tortor urna, tincidunt sed dictum id, rutrum tempus sapien.

Donec accumsan ante ac odio laoreet porttitor. Pellentesque et leo a leo scelerisque mattis id vel elit. Quisque egestas congue enim nec semper. Morbi mollis nibh sapien. Nunc quis fringilla lorem. Donec vel venenatis nunc. Donec lectus velit, tempor sit amet dui sed, consequat commodo enim. Nam porttitor neque semper, dapibus nunc bibendum, lobortis urna. Morbi ullamcorper molestie lectus a elementum. Curabitur eu cursus orci, sed tristique justo. In massa lacus, imperdiet eu elit quis, consectetur maximus magna. Integer suscipit varius ante vitae egestas. Morbi scelerisque fermentum ipsum, euismod faucibus mi tincidunt id. Sed at consectetur velit. Ut fermentum nunc nibh, at commodo felis lacinia nec.

Nullam a justo quis lectus facilisis semper eget quis sem. Morbi suscipit erat sem, non fermentum nunc luctus vel. Proin venenatis quam ut arcu luctus efficitur. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nam sollicitudin tristique nunc nec convallis. Maecenas id tortor semper, tempus nisl laoreet, cursus lacus. Aliquam sagittis est in leo congue, a pharetra felis aliquet. Nulla gravida lobortis sapien, quis viverra enim ullamcorper sed. Donec ultrices sem eu volutpat dapibus. Nam euismod, tellus eu congue mollis, massa nisi finibus odio, vitae porta arcu urna ac lorem. Sed faucibus dignissim pretium. Pellentesque eget ante tellus. Pellentesque a elementum odio, sit amet vulputate diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In hendrerit consequat dolor, malesuada pellentesque tellus molestie non. Aenean quis purus a lectus pellentesque laoreet.

', 'picture' => 'galerie/landscape/desert.jpg', - 'hidePicture' => false, + 'hidePicture' => false, + 'pictureSize' => 40, 'publishedOn' => 1550432502, 'state' => true, 'title' => 'Mon deuxième article', @@ -526,7 +528,8 @@ class init extends common { 'comment' => [], 'content' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ut tempus nibh. Cras eget iaculis justo, ac laoreet lacus. Nunc tellus nulla, auctor id hendrerit eu, pellentesque in sapien. In hac habitasse platea dictumst. Aliquam leo urna, hendrerit id nunc eget, finibus maximus dolor. Sed rutrum sapien consectetur, tincidunt nulla at, blandit quam. Duis ex enim, vehicula vel nisi vitae, lobortis volutpat nisl. Vivamus enim libero, euismod nec risus vel, interdum placerat elit. In cursus sapien condimentum dui imperdiet, sed lobortis ante consectetur. Maecenas hendrerit eget felis non consequat.

Nullam nec risus non velit efficitur tempus eget tincidunt mauris. Etiam venenatis leo id justo sagittis, commodo dignissim sapien tristique. Vivamus finibus augue malesuada sapien gravida rutrum. Integer mattis lectus ac pulvinar scelerisque. Integer suscipit feugiat metus, ac molestie odio suscipit eget. Fusce at elit in tellus venenatis finibus id sit amet magna. Integer sodales luctus neque blandit posuere. Cras pellentesque dictum lorem eget vestibulum. Quisque vitae metus non nisi efficitur rhoncus ut vitae ipsum. Donec accumsan massa at est faucibus lacinia. Quisque imperdiet luctus neque eu vestibulum. Phasellus pellentesque felis ligula, id imperdiet elit ultrices eu.

', 'picture' => 'galerie/landscape/iceberg.jpg', - 'hidePicture' => false, + 'hidePicture' => false, + 'pictureSize' => 100, 'publishedOn' => 1550864502, 'state' => true, 'title' => 'Mon troisième article', diff --git a/module/blog/blog.php b/module/blog/blog.php index c5dd86aa..aaa05e6a 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -35,9 +35,23 @@ class blog extends common { true => 'Publié' ]; + public static $pictureSizes = [ + '20' => 'Très petite', + '30' => 'Petite', + '40' => 'Grande', + '50' => 'Très Grande', + '100' => 'Pleine largeur', + ]; + + public static $picturePositions = [ + 'left' => 'À gauche', + 'right' => 'À droite ', + ]; + + public static $users = []; - const BLOG_VERSION = '1.9'; + const BLOG_VERSION = '2.0'; /** * Édition @@ -264,7 +278,9 @@ class blog extends common { 'comment' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment']), 'content' => $this->getInput('blogEditContent', null), 'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true), - 'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN), + 'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN), + 'pictureSize' => $this->getInput('blogEditPictureSize', helper::FILTER_STRING_SHORT), + 'picturePosition' => $this->getInput('blogEditPicturePosition', helper::FILTER_STRING_SHORT), 'publishedOn' => $this->getInput('blogEditPublishedOn', helper::FILTER_DATETIME, true), 'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN), 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), diff --git a/module/blog/view/article/article.css b/module/blog/view/article/article.css index a56f6054..e75691a1 100755 --- a/module/blog/view/article/article.css +++ b/module/blog/view/article/article.css @@ -1,11 +1,40 @@ + +#sectionTitle { + margin-top: 0; + margin-bottom: 5px; +} .blogArticlePicture { height: auto; - width: 100%; - background-size: cover; - background-repeat: no-repeat; - background-position: center center; - margin-top: 15px; + border:1px solid lightgray; + box-shadow: 1px 1px 5px; } +.blogArticlePictureleft { + float: left; + margin: 15px 10px 5px 0 ; +} +.blogArticlePictureright { + float: right; + margin: 15px 0 5px 10px ; +} + + +.pict20{ + width: 20%; +} +.pict30{ + width: 30%; +} +.pict40{ + width: 40%; +} +.pict50{ + width: 50%; +} +.pict100{ + width: 100%; + margin: 15px 0 20px 0 ; +} + #blogArticleCommentShow { cursor: text; } @@ -16,7 +45,6 @@ font-size:0.8em; font-style: italic; color: grey; - margin-left: 10px; } @media (max-width: 767px) { .blogArticlePicture { diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 8de5f2f1..95bdabe9 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -5,7 +5,9 @@ getData(['module', $this->getUrl(0), $this->getUrl(1), 'hidePicture']) == false) { - echo '
' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picture']) . '
'; + echo '' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picture']) . ''; } ?> getData(['module', $this->getUrl(0), $this->getUrl(1), 'content']); ?> @@ -17,14 +19,14 @@

getUser('group') >= self::GROUP_ADMIN): ?>
-
+
helper::baseUrl() . $this->getUrl(0), 'ico' => 'left', 'value' => 'Retour' ]); ?>
-
+
helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], 'value' => 'Editer' diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index 6b37fd3f..195b83f9 100755 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -28,13 +28,15 @@

Informations générales

-
+
'Titre', 'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title']) ]); ?>
-
+
+
+
'Taille optimale de l\'image de couverture : ' . ((int) substr($this->getData(['theme', 'site', 'width']), 0, -2) - (20 * 2)) . ' x 350 pixels.', 'label' => 'Image de couverture', @@ -42,8 +44,21 @@ 'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'picture']) ]); ?>
-
+
+ 'Largeur de l\'image', + 'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'pictureSize']) + ]); ?>
+
+ 'Position', + 'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'picturePosition']), + 'help' => 'Le texte de l\'article est adapté autour de l\'image' + ]); ?> +
+
+
$this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'hidePicture']) diff --git a/module/blog/view/index/index.css b/module/blog/view/index/index.css index 74014f6f..ef3b56bc 100755 --- a/module/blog/view/index/index.css +++ b/module/blog/view/index/index.css @@ -1,10 +1,21 @@ +.rowArticle { + margin-bottom: 10px !important; +} +.blogArticle { + margin: 15px !important; + background-color: lightgrey; +} .blogPicture { float: none; + border: 1px; } .blogPicture img { width: 100%; height: auto; - } + border:1px solid lightgray; + box-shadow: 1px 1px 5px; +} + .blogPicture:hover { opacity: .7; } @@ -19,16 +30,18 @@ } .blogTitle { /*background-color: #ECEFF1;*/ - padding: 5px; + padding: 0px; + margin-bottom: 5px; } .blogContent { float: left; + margin-top: 5px; } .blogDate { font-size:0.8em; font-style: italic; color: grey; - margin-left: 10px; + } @media (max-width: 768px) { .blogContent { diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index 05b283c6..3d03bb18 100755 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -2,7 +2,7 @@
$article): ?> -
+

- ... + ... Lire la suite

-