diff --git a/.woodpecker.yml b/.woodpecker.yml index 39982a5..853c403 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -77,7 +77,6 @@ pipeline: - sed -i "s#app_directory#$APP_DIRECTORY#g" .mage.yml - /root/.config/composer/vendor/bin/mage deploy "$CI_BUILD_DEPLOY_TARGET" when: - branch: [master, master-*, develop, develop-*] event: [deployment] services: diff --git a/assets/css/app.scss b/assets/css/app.scss index b10d387..5b944f3 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -463,10 +463,14 @@ pre[class*="language-"] { cursor: pointer; } - a:not(.button), h1, h2, h3, h4, h5, p, ul { + a:not(.button), h1, h2, h3, h4, h5, p, ul:not(.btn-group) { color: $color-body-text; } + ul.btn-group a { + color: #fff; + } + p a, ul a { border-bottom: 2px dotted $color-blue2; } @@ -1253,7 +1257,7 @@ $links: ( } .bg-box { - background: #fbfcff; + background: #f1f1f1; } .invalid-feedback { diff --git a/assets/images/post-image-logo.png b/assets/images/post-image-logo.png new file mode 100644 index 0000000..f1d9a58 Binary files /dev/null and b/assets/images/post-image-logo.png differ diff --git a/assets/js/app/px-image.js b/assets/js/app/px-image.js index 71cc15d..fa77d1b 100644 --- a/assets/js/app/px-image.js +++ b/assets/js/app/px-image.js @@ -9,16 +9,22 @@ class PxImage { const images = doc.querySelectorAll('.quick-image img, .card figure img') for (let i = 0, len = images.length; i < len; i++) { - (function(image) { + ((image) => { const source = image.getAttribute('data-src') + const sourceError = image.getAttribute('data-src-error') + const color = image.getAttribute('data-color') const loader = new Image() - loader.onload = function() { - image.style.backgroundImage = 'url(' + source + ')' + loader.onload = () => { + image.style.background = `${color ? color : null} url(${source})` image.style.backgroundSize = 'cover' image.style.backgroundPosition = 'center' } + loader.onerror = () => { + image.style.background = `${color ? color : null} url('${sourceError}') center center` + } + loader.src = source })(images[i]) } diff --git a/src/Controller/Blog/PostController.php b/src/Controller/Blog/PostController.php index 918eb90..fe4e369 100644 --- a/src/Controller/Blog/PostController.php +++ b/src/Controller/Blog/PostController.php @@ -95,7 +95,7 @@ class PostController extends PageController public function posts(int $page = 1): Response { $entities = $this->createQuery() - ->paginate($page, 5) + ->paginate($page, 9) ; return $this->defaultRender($this->siteRequest->getPage()->getTemplate(), [ @@ -111,7 +111,7 @@ class PostController extends PageController if ($query || $tag) { $entities = $this->createQuery() ->search($query, $tag) - ->paginate($page, 5) + ->paginate($page, 9) ; } @@ -126,7 +126,7 @@ class PostController extends PageController { $entities = $this->createQuery() ->inCategory($category, false) - ->paginate($page, 5) + ->paginate($page, 9) ; if (!$category->getIsActive() && !$this->getUser()) { diff --git a/src/Twig/Extension/ColorExtension.php b/src/Twig/Extension/ColorExtension.php new file mode 100644 index 0000000..09311bc --- /dev/null +++ b/src/Twig/Extension/ColorExtension.php @@ -0,0 +1,38 @@ + - {% endif %} - - {{ include('page/post/_post.html.twig', {post: post}) }} - {% endfor %} +
+ {% for post in pager %} +
+ {{ include('page/post/_post_card.html.twig') }} +
+ {% endfor %} +
{% if pager.getPaginationData.pageCount > 1 %}
diff --git a/templates/page/post/_post.html.twig b/templates/page/post/_post.html.twig index 3a18d64..7490782 100644 --- a/templates/page/post/_post.html.twig +++ b/templates/page/post/_post.html.twig @@ -76,26 +76,8 @@
{% for item in similarPosts %} - {% set url = safe_path('blog_menu_post', {post: item.id, slug: item.slug, _domain: _domain}) %} -
- + {{ include('page/post/_post_card.html.twig', {post: item, summarySize: 100}) }}
{% endfor %}
diff --git a/templates/page/post/_post_card.html.twig b/templates/page/post/_post_card.html.twig new file mode 100644 index 0000000..0862143 --- /dev/null +++ b/templates/page/post/_post_card.html.twig @@ -0,0 +1,42 @@ +{% set url = safe_path('blog_menu_post', {post: post.id, slug: post.slug, _domain: _domain}) %} +{% set color = generate_color_by_string(post.title) %} + +{%- set image -%} + {%- if post.image -%} + {{ asset(post.image)|imagine_filter('post_preview_filter') }} + {%- elseif post.quickImage -%} + {{ post.quickImage }} + {% else %} + {{ asset('build/images/post-image-logo.png') }} + {%- endif -%} +{%- endset -%} + +
+ + {{ post.title }} + +
+ +
+

+ + {{- post.title|nbsp|raw -}} + +

+ + {% set content %} + {% if post.contentFormat == 'html' %} + {{- post.content|murph_url|file_attributes|post -}} + {% elseif post.contentFormat == 'markdown' %} + {{- post.content|murph_url|file_attributes|markdown('post')|lazy_load -}} + {% elseif post.contentFormat == 'editorjs' %} + {{- post.content|murph_url|file_attributes|editorjs_to_html|raw -}} + {% endif %} + {%- endset -%} + + {% set summarySize = summarySize ?? 200 %} + + {% set content = content|striptags[:summarySize] %} + +

{{ content }}{% if content|length >= summarySize %}…{% endif %}

+
diff --git a/templates/page/posts/default.html.twig b/templates/page/posts/default.html.twig index 9edec9f..f82738c 100644 --- a/templates/page/posts/default.html.twig +++ b/templates/page/posts/default.html.twig @@ -1,13 +1,13 @@ {% extends "page/titled/default.html.twig" %} {% block body %} - {% for post in pager %} - {% if not loop.first %} -
- {% endif %} - - {{ include('page/post/_post.html.twig', {post: post}) }} - {% endfor %} +
+ {% for post in pager %} +
+ {{ include('page/post/_post_card.html.twig') }} +
+ {% endfor %} +
{% if pager.getPaginationData.pageCount > 1 %}
diff --git a/templates/page/search/default.html.twig b/templates/page/search/default.html.twig index c3dfd74..e1fb848 100644 --- a/templates/page/search/default.html.twig +++ b/templates/page/search/default.html.twig @@ -14,13 +14,13 @@
{% if pager %} - {% for post in pager %} - {% if not loop.first %} -
- {% endif %} - - {{ include('page/post/_post.html.twig', {post: post}) }} - {% endfor %} +
+ {% for post in pager %} +
+ {{ include('page/post/_post_card.html.twig') }} +
+ {% endfor %} +
{% if pager.getPaginationData.pageCount > 1 %}