Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Jan 13, 2022
1 parent d65d8a3 commit bb42aef
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 136 deletions.
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -61,7 +61,7 @@
"symfony/web-link": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.8",
"symfony/yaml": "^5.4 || ^6.0",
"thecodingmachine/safe": "^1.3",
"thecodingmachine/safe": "^1.3 || ^2.0",
"twig/intl-extra": "^3.2",
"vich/uploader-bundle": "^1.16",
"villfa/invert-color": "^0.5",
Expand All @@ -82,10 +82,10 @@
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/maker-bundle": "^1.35",
"symfony/panther": "^1 || ^2.0",
"symfony/phpunit-bridge": "^5.0",
"symfony/phpunit-bridge": "^5.0 || ^6.0",
"symfony/profiler-pack": "^1.0",
"symfony/test-pack": "^1.0",
"symplify/monorepo-builder": "^9.0",
"symplify/monorepo-builder": "^10.0",
"vimeo/psalm": "^4",
"weirdan/doctrine-psalm-plugin": "^2.0"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/admin-block-editor/src/BlockEditorFilter.php
Expand Up @@ -11,11 +11,9 @@
use Pushword\Core\AutowiringTrait\RequiredEntityTrait;
use Pushword\Core\AutowiringTrait\RequiredTwigTrait;
use Pushword\Core\Component\EntityFilter\Filter\AbstractFilter;
use Pushword\Core\Twig\ClassTrait;

final class BlockEditorFilter extends AbstractFilter
{
use ClassTrait;
use RequiredAppTrait;
use RequiredEntityTrait;
use RequiredTwigTrait;
Expand Down
@@ -1,4 +1,4 @@
<div{{ blockWrapperAttr(block, {class: class(page, 'prose')}) }}>
<div{{ blockWrapperAttr(block, {class: 'prose mx-auto'}) }}>
{{ block.data.style == 'unordered' ? '<ul>' : '<ol>' }}
{% for item in block.data.items %}
{% if item.content is defined %}
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Menu/PageMenuProvider.php
Expand Up @@ -69,7 +69,7 @@ private function isEditing(string $host): bool
{
if (($request = $this->requestStack->getCurrentRequest()) !== null
&& ($filter = $request->query->get('filter')) !== null) {
return $filter['host']['value'][0] === $host;
return $filter['host']['value'][0] === $host; // @phpstan-ignore-line
}

return false;
Expand Down
29 changes: 13 additions & 16 deletions packages/conversation/src/Resources/config/services.yaml
@@ -1,21 +1,25 @@
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$env: "%kernel.environment%"
$message: '%pw.conversation.entity_message%'
$projectDir: '%kernel.project_dir%'
$messageEntity: '%pw.conversation.entity_message%'
# --------
# ContactBundle
# --------

Pushword\Conversation\PushwordConversation: ~

Pushword\Conversation\:
autowire: true
resource: '../../../src/*'
exclude: '../../../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php,Installer/install.php}'

# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
Pushword\Conversation\Controller\:
autowire: true
bind:
$env: "%kernel.environment%"
resource: '../../../src/Controller'
tags: ['controller.service_arguments']

Expand All @@ -35,25 +39,18 @@ services:

pushword.conversation.notifier:
class: Pushword\Conversation\Service\NewMessageMailNotifier
autowire: true
arguments:
$message: '%pw.conversation.entity_message%'
$projectDir: '%kernel.project_dir%'

pushword.conversation.notification_command:
arguments:
- '@pushword.conversation.notifier'
class: Pushword\Conversation\Command\NotificationCommand
tags: ['console.command']

pushword.conversation.twig_extension:
class: Pushword\Conversation\Twig\AppExtension
autowire: true
tags:
- 'twig.extension'
#- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
arguments:
$messageEntity: '%pw.conversation.entity_message%'
# pushword.conversation.twig_extension:
# class: Pushword\Conversation\Twig\AppExtension
# tags:
# - 'twig.extension'
# #- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }

Pushword\Conversation\Repository\MessageRepository:
arguments: ['@doctrine', '%pw.conversation.entity_message%']
Expand Down
2 changes: 1 addition & 1 deletion packages/core/composer.json
Expand Up @@ -21,7 +21,7 @@
"piedweb/render-html-attributes": "^2.0.1",
"piedweb/url-harvester": "^0.0.31",
"pushword/skeleton": "*",
"thecodingmachine/safe": "^1.3",
"thecodingmachine/safe": "^1.3 || ^2.0",
"sensio/framework-extra-bundle": "^5.6",
"spatie/image-optimizer": "^1.3",
"symfony/asset": "^5.3 || ^6.0",
Expand Down
15 changes: 2 additions & 13 deletions packages/core/src/Resources/assets/tailwind.config.js
@@ -1,4 +1,5 @@
const plugin = require("tailwindcss/plugin");
import { extendTailwindTypography } from "@pushword/js-helper/src/tailwind.helpers.js";

module.exports = {
mode: "jit",
Expand All @@ -14,19 +15,7 @@ module.exports = {
full: "100%",
},
extend: {
typography: {
DEFAULT: {
css: {
color: "#333",
"a, span[data-rot]": {
color: "var(--primary)",
"&:hover": {
opacity: ".75",
},
},
},
},
},
typography: extendTailwindTypography(),
colors: {
primary: "var(--primary)",
secondary: "var(--secondary)",
Expand Down
Expand Up @@ -6,5 +6,5 @@ vich_uploader:
#uri_prefix:
upload_destination: '%pw.media_dir%'
namer:
service: Pushword\Core\Service\VichUploadPropertyNamer #Vich\UploaderBundle\Naming\PropertyNamer
service: Vich\UploaderBundle\Naming\PropertyNamer #Pushword\Core\Service\VichUploadPropertyNamer
options: { property: 'slug' }
18 changes: 9 additions & 9 deletions packages/core/src/Resources/config/services.yaml
Expand Up @@ -129,12 +129,12 @@ services:

# Vich
# --------

vich_uploader.pushword.namer_property:
class: Pushword\Core\Service\VichUploadPropertyNamer
public: true
arguments: ['@Vich\UploaderBundle\Util\Transliterator']

Pushword\Core\Service\VichUploadPropertyNamer:
alias: vich_uploader.pushword.namer_property
public: true
# todo : to delete
# vich_uploader.pushword.namer_property:
# class: Pushword\Core\Service\VichUploadPropertyNamer
# public: true
# arguments: ['@Vich\UploaderBundle\Util\Transliterator']

# Pushword\Core\Service\VichUploadPropertyNamer:
# alias: vich_uploader.pushword.namer_property
# public: true
2 changes: 0 additions & 2 deletions packages/core/src/Twig/AppExtension.php
Expand Up @@ -31,7 +31,6 @@ class AppExtension extends AbstractExtension
{
// TODO switch from Trait to service (will be better to test and add/remove twig extension)
//use AttributesTrait;
use ClassTrait;
use GalleryTwigTrait;
use LinkTwigTrait;
use PageListTwigTrait;
Expand Down Expand Up @@ -121,7 +120,6 @@ public function getFunctions(): array
new TwigFunction('pager', [$this, 'renderPager'], self::options(true)),
new TwigFunction('pages_list', [$this, 'renderPagesList'], self::options(true)),
new TwigFunction('pages', [$this, 'getPublishedPages'], self::options()),
new TwigFunction('class', [$this, 'getHtmlClass'], self::options()),
new TwigFunction('pw', [$this->entityFilterManagerPool, 'getProperty'], self::options()),
new TwigFunction('filesize', [FilesizeFormatter::class, 'formatBytes'], self::options()),
];
Expand Down
42 changes: 0 additions & 42 deletions packages/core/src/Twig/ClassTrait.php

This file was deleted.

72 changes: 35 additions & 37 deletions packages/core/src/templates/page/_content.html.twig
@@ -1,54 +1,52 @@
{% block content %}
<!--{{ pw(page).mainContent.chapeau|raw }}--> {# TODO: fix bug, if pw(page).ma... is not called before we really need it, it don't work #}
<div{{ class(page, 'container', 'py-12 px-3') }}> {# /!\ must be sync with \Pushword\Core\Twig\ClassTrait::$defaultContainerClass #}
<div{{ class(page, 'prose', 'prose') }}>

{% block content_header %}
{% block h1 %}
<h1>{{ pw(page).h1|raw }}</h1>
{% endblock %}

{% block description %}
{{ pw(page).mainContent.chapeau is defined ? pw(page).mainContent.chapeau|raw : '' }}
{% endblock %}

{% block main_image %}
{% if page.mainImage is not null %}
{% include view('/component/image_inline.html.twig') with {
'image_src': page.mainImage|image('default'),
'image_alt': page.mainImage.name(page.locale, true)|default(page.getTitle(true)|striptags),
'image_wrapper_class': (page.mainImageFormat is same as(1) ? 'hidden' : ' '),
} %}
{# @var page.mainImageFormat is a custom property wich culd be managed via advanced-main-image #}
{% endif %}
{% endblock %}
<div class="prose mx-auto py-12 px-3 md:px-0">

{% block content_header %}
{% block h1 %}
<h1>{{ pw(page).h1|raw }}</h1>
{% endblock %}

{% block description %}
{{ pw(page).mainContent.chapeau is defined ? pw(page).mainContent.chapeau|raw : '' }}
{% endblock %}

{% block main_content %}
{% if page.toc is not null or page.tocTitle is not null %}
{% block toc %}
{{ pw(page).mainContent.intro|raw }}
<h3>{{ page.tocTitle|default('Nav')}}</h3>
{{ pw(page).mainContent.toc|raw }}
{{ pw(page).mainContent.content|raw }}
{% endblock %}
{% else %}
{{ pw(page).mainContent.body|raw }}
{% block main_image %}
{% if page.mainImage is not null %}
{% include view('/component/image_inline.html.twig') with {
'image_src': page.mainImage|image('default'),
'image_alt': page.mainImage.name(page.locale, true)|default(page.getTitle(true)|striptags),
'image_wrapper_class': (page.mainImageFormat is same as(1) ? 'hidden' : ' '),
} %}
{# @var page.mainImageFormat is a custom property wich culd be managed via advanced-main-image #}
{% endif %}
{% endblock %}
{% endblock %}


{% block main_content %}
{% if page.toc is not null or page.tocTitle is not null %}
{% block toc %}
{{ pw(page).mainContent.intro|raw }}
<h3>{{ page.tocTitle|default('Nav')}}</h3>
{{ pw(page).mainContent.toc|raw }}
{{ pw(page).mainContent.content|raw }}
{% endblock %}
{% else %}
{{ pw(page).mainContent.body|raw }}
{% endif %}
{% endblock %}

{# todo: if main.content.body finished with an opening div, remove it and remove the next div close :
preg_replace('#<div class="prose">\S*</div>#si', '', html) #}
{# todo: if main.content.body finished with an opening div, remove it and remove the next div close :
preg_replace('#<div class="prose">\S*</div>#si', '', html) #}

</div>
</div>

{% block content_part %}
{% if pw(page).mainContent.contentParts %}
{% for contentPart in pw(page).mainContent.contentParts %}
<div{{ class(page, 'partContainer', 'py-12 px-3 ' ~ cycle([page_delimiter_cycle|default('bg-gray-200'), ''], loop.index0)) }}>
<div{{ class(page, 'prose', 'prose') }}>
<div class="py-12 px-3 {{ cycle([page_delimiter_cycle|default('bg-gray-200'), ''], loop.index0)) }}">
<div class="prose mx-auto">
{{ contentPart|raw }}
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions packages/js-helper/src/tailwind.helpers.js
@@ -0,0 +1,15 @@
export function extendTailwindTypography() {
return {
DEFAULT: {
css: {
":where(a):not(:where([class~=not-prose] *)), :where(span[data-rot]):not(:where([class~=not-prose] *))":
{
color: "var(--primary)",
"&:hover": {
opacity: ".75",
},
},
},
},
};
}
8 changes: 0 additions & 8 deletions packages/js-helper/src/tailwind.prose.scss
@@ -1,11 +1,3 @@
/**
* Override tailwind prose
*/
.prose {
width: 100%;
margin: 0 auto;
}

/**
* Relative to link
*/
Expand Down

0 comments on commit bb42aef

Please sign in to comment.