From d2b403cde87ecda8920e79bf19f6c73823c22a95 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 1 Dec 2017 18:11:07 +0000 Subject: [PATCH] done #1785 @0.5 --- framework/application/models/News.php | 2 ++ framework/application/views/helpers/News.php | 5 +-- js/news.js | 4 +-- less/news.less | 33 +++++++++++++++----- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/framework/application/models/News.php b/framework/application/models/News.php index 9bd0e63..0833429 100644 --- a/framework/application/models/News.php +++ b/framework/application/models/News.php @@ -9,6 +9,8 @@ class CCGM_Model_News extends CubeIT_Model_Data_Table { protected $image; protected $title; + protected $_types = ['link' => 'json']; + public static function getSchema($schema) { $table = parent::getSchema($schema); $table->addColumn('title', 'string', array('length' => 128)); diff --git a/framework/application/views/helpers/News.php b/framework/application/views/helpers/News.php index 62b06eb..155cb20 100644 --- a/framework/application/views/helpers/News.php +++ b/framework/application/views/helpers/News.php @@ -6,8 +6,6 @@ class CCGM_View_Helper_News extends CubeIT_View_Helper_Abstract { */ public function news() { $allnews = CCGM_Model_News::factory()->order('date DESC')->find(); - - $res = ''; foreach ($allnews as $news) { @@ -21,7 +19,10 @@ class CCGM_View_Helper_News extends CubeIT_View_Helper_Abstract { $res = $this->imageProcess($n->getImage(), '', 200, 200); $c = $this->dateTime($n->getDate(), CubeIT_Date::DAY . '/' . CubeIT_Date::MONTH . '/' . CubeIT_Date::YEAR); $c .= $this->htmlElement($n->getTitle(), 'h2'); + $c .= '
'; $c .= $this->markupDotclear($n->getContent()); + $c .= $this->linkCMS($n->getLink()); + $c .= '
'; $c .= $this->link('Lire la suite', '#', ['class' => 'more']); $c .= $this->link('Réduire', '#', ['class' => 'less']); $res .= $this->htmlElement($c, 'div', ['class' => 'c']); diff --git a/js/news.js b/js/news.js index 6f81869..95b5176 100644 --- a/js/news.js +++ b/js/news.js @@ -11,7 +11,7 @@ $(this.element).on('click', '.more', function () { var c = $(this).closest('.c'); - var d = $(c).find('.dotclear'); + var d = $(c).find('.acc'); d.css({maxHeight: 999}); $(this).hide(); $(c).find('.less').show(); @@ -23,7 +23,7 @@ $(this.element).on('click', '.less', function () { var c = $(this).closest('.c'); - var d = $(c).find('.dotclear'); + var d = $(c).find('.acc'); d.css({maxHeight: 72}); $(this).hide(); $(c).find('.more').show(); diff --git a/less/news.less b/less/news.less index 6ed209d..f5024e0 100644 --- a/less/news.less +++ b/less/news.less @@ -5,7 +5,7 @@ border-bottom: 1px solid #dad9d9; padding-bottom: 48px; margin-bottom: 48px; - &:last-child{ + &:last-child { border-bottom: none; margin-bottom: 0; } @@ -33,13 +33,30 @@ font-size: 26px; } - .dotclear { - line-height: 24px; + .acc { max-height: 72px; overflow: hidden; transition: max-height 450ms; margin-bottom: 30px; - p:last-child{ + > a { + display: inline-block; + text-align: center; + box-sizing: border-box; + white-space: nowrap; + background-color: #0ea6db; + font-weight: 300; + font-style: italic; + line-height: 29px; + border-radius: 3px; + color: #fff; + padding: 0 13px 1px 10px; + margin: 20px 0 20px 1px; + } + } + + .dotclear { + line-height: 24px; + p:last-child { margin-bottom: 0; } } @@ -49,8 +66,8 @@ font-weight: 500; font-size: 16px; display: block; - &:after{ - content:""; + &:after { + content: ""; display: inline-block; margin-left: 10px; width: 15px; @@ -63,9 +80,9 @@ } } - .less{ + .less { display: none; - &:after{ + &:after { transform: rotate(270deg); } } -- 2.39.5