@@ -2,6 +2,7 @@ | |||
namespace Lc\SovBundle\Container\Newsletter; | |||
use Lc\SovBundle\Definition\Field\Newsletter\NewsletterFieldDefinition; | |||
use Lc\SovBundle\Factory\Newsletter\NewsletterFactory; | |||
use Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryQuery; | |||
use Lc\SovBundle\Repository\Newsletter\NewsletterStore; | |||
@@ -11,15 +12,18 @@ class NewsletterContainer | |||
protected NewsletterFactory $factory; | |||
protected NewsletterRepositoryQuery $repositoryQuery; | |||
protected NewsletterStore $store; | |||
protected NewsletterFieldDefinition $fieldDefinition; | |||
public function __construct( | |||
NewsletterFactory $factory, | |||
NewsletterRepositoryQuery $repositoryQuery, | |||
NewsletterStore $store | |||
NewsletterStore $store, | |||
NewsletterFieldDefinition $fieldDefinition | |||
) { | |||
$this->factory = $factory; | |||
$this->repositoryQuery = $repositoryQuery; | |||
$this->store = $store; | |||
$this->fieldDefinition = $fieldDefinition; | |||
} | |||
public function getFactory(): NewsletterFactory | |||
@@ -36,4 +40,9 @@ class NewsletterContainer | |||
{ | |||
return $this->store; | |||
} | |||
public function getFieldDefinition(): NewsletterFieldDefinition | |||
{ | |||
return $this->fieldDefinition; | |||
} | |||
} |
@@ -2,6 +2,7 @@ | |||
namespace Lc\SovBundle\Container\Site; | |||
use Lc\SovBundle\Definition\Field\Site\NewsFieldDefinition; | |||
use Lc\SovBundle\Factory\Site\NewsFactory; | |||
use Lc\SovBundle\Repository\Site\NewsRepositoryQuery; | |||
use Lc\SovBundle\Repository\Site\NewsStore; | |||
@@ -11,15 +12,18 @@ class NewsContainer | |||
protected NewsFactory $factory; | |||
protected NewsRepositoryQuery $repositoryQuery; | |||
protected NewsStore $store; | |||
protected NewsFieldDefinition $fieldDefinition; | |||
public function __construct( | |||
NewsFactory $factory, | |||
NewsRepositoryQuery $repositoryQuery, | |||
NewsStore $store | |||
NewsStore $store, | |||
NewsFieldDefinition $fieldDefinition | |||
) { | |||
$this->factory = $factory; | |||
$this->repositoryQuery = $repositoryQuery; | |||
$this->store = $store; | |||
$this->fieldDefinition = $fieldDefinition; | |||
} | |||
public function getFactory(): NewsFactory | |||
@@ -36,4 +40,9 @@ class NewsContainer | |||
{ | |||
return $this->store; | |||
} | |||
public function getFieldDefinition(): NewsFieldDefinition | |||
{ | |||
return $this->fieldDefinition; | |||
} | |||
} |
@@ -2,6 +2,7 @@ | |||
namespace Lc\SovBundle\Container\Site; | |||
use Lc\SovBundle\Definition\Field\Site\PageFieldDefinition; | |||
use Lc\SovBundle\Factory\Site\PageFactory; | |||
use Lc\SovBundle\Repository\Site\PageRepositoryQuery; | |||
use Lc\SovBundle\Repository\Site\PageStore; | |||
@@ -11,15 +12,18 @@ class PageContainer | |||
protected PageFactory $factory; | |||
protected PageRepositoryQuery $repositoryQuery; | |||
protected PageStore $store; | |||
protected PageFieldDefinition $fieldDefinition; | |||
public function __construct( | |||
PageFactory $factory, | |||
PageRepositoryQuery $repositoryQuery, | |||
PageStore $store | |||
PageStore $store, | |||
PageFieldDefinition $fieldDefinition | |||
) { | |||
$this->factory = $factory; | |||
$this->repositoryQuery = $repositoryQuery; | |||
$this->store = $store; | |||
$this->fieldDefinition = $fieldDefinition; | |||
} | |||
public function getFactory(): PageFactory | |||
@@ -36,4 +40,9 @@ class PageContainer | |||
{ | |||
return $this->store; | |||
} | |||
public function getFieldDefinition(): PageFieldDefinition | |||
{ | |||
return $this->fieldDefinition; | |||
} | |||
} |
@@ -8,9 +8,9 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Field\CollectionField; | |||
use Lc\SovBundle\Field\ImageManagerField; | |||
use Lc\SovBundle\Field\StatusField; | |||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||
use PhpParser\Node\Expr\Throw_; | |||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||
abstract class AbstractFieldDefinition | |||
@@ -29,13 +29,17 @@ abstract class AbstractFieldDefinition | |||
return [ | |||
'id' => IntegerField::new('id')->onlyOnIndex()->setSortable(true), | |||
'metaTitle' => TextField::new('metaTitle') | |||
->setLabel('Meta Title') | |||
->setHelp('Affiché dans les résultats de recherche Google') | |||
->hideOnIndex(), | |||
->setLabel('Meta : title') | |||
->setHelp('Affiché dans les résultats de recherche Google'), | |||
'metaDescription' => TextareaField::new('metaDescription') | |||
->setLabel('Meta description') | |||
->setHelp('Affiché dans les résultats de recherche Google') | |||
->hideOnIndex(), | |||
->setLabel('Meta : description') | |||
->setHelp('Affiché dans les résultats de recherche Google'), | |||
'openGraphTitle' => TextField::new('openGraphTitle') | |||
->setLabel('OpenGraph : titre'), | |||
'openGraphDescription' => TextareaField::new('openGraphDescription') | |||
->setLabel('OpenGraph : description'), | |||
'openGraphImage' => ImageManagerField::new('openGraphImage') | |||
->setLabel('OpenGraph : image'), | |||
'oldUrls' => CollectionField::new('oldUrls') | |||
->setFormTypeOption('entry_type', TextType::class) | |||
->setLabel('Anciennes urls du document') | |||
@@ -79,6 +83,15 @@ abstract class AbstractFieldDefinition | |||
]; | |||
} | |||
public function configurePanelOpengraph(): array | |||
{ | |||
return [ | |||
'openGraphTitle', | |||
'openGraphDescription', | |||
'openGraphImage' | |||
]; | |||
} | |||
public function configurePanelConf(): array | |||
{ | |||
return [ | |||
@@ -105,7 +118,7 @@ abstract class AbstractFieldDefinition | |||
{ | |||
return array_merge( | |||
$this->configureFieldsBase(), | |||
$this->configureFields() | |||
$this->configureFields(), | |||
); | |||
} | |||
@@ -0,0 +1,45 @@ | |||
<?php | |||
namespace Lc\SovBundle\Definition\Field\Newsletter; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition; | |||
use Lc\SovBundle\Field\BooleanField; | |||
use Lc\SovBundle\Field\CKEditorField; | |||
class NewsletterFieldDefinition extends AbstractFieldDefinition | |||
{ | |||
public function configureIndex(): array | |||
{ | |||
return [ | |||
'id', | |||
'title', | |||
'isMain', | |||
'status' | |||
]; | |||
} | |||
public function configurePanels(): array | |||
{ | |||
return ['main', 'seo', 'conf']; | |||
} | |||
public function configurePanelMain(): array | |||
{ | |||
return [ | |||
'title', | |||
'description', | |||
'status' | |||
]; | |||
} | |||
public function configureFields(): array | |||
{ | |||
return [ | |||
'title' => TextField::new('title'), | |||
'description' => CKEditorField::new('description')->hideOnIndex(), | |||
'isMain' => BooleanField::new('isMain')->setCustomOption('toggle_label', 'Principale'), | |||
]; | |||
} | |||
} |
@@ -0,0 +1,58 @@ | |||
<?php | |||
namespace Lc\SovBundle\Definition\Field\Site; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition; | |||
use Lc\SovBundle\Field\BooleanField; | |||
use Lc\SovBundle\Field\ImageManagerField; | |||
class NewsFieldDefinition extends AbstractFieldDefinition | |||
{ | |||
public function configureIndex(): array | |||
{ | |||
return [ | |||
'id', | |||
'title', | |||
'status' | |||
]; | |||
} | |||
public function configurePanels(): array | |||
{ | |||
return ['main', 'seo', 'opengraph', 'conf']; | |||
} | |||
public function configurePanelMain(): array | |||
{ | |||
return [ | |||
'date', | |||
'title', | |||
'newsletter', | |||
'image', | |||
'description', | |||
'isSent', | |||
'status' | |||
]; | |||
} | |||
public function configureFields(): array | |||
{ | |||
return [ | |||
'date' => DateField::new('date') | |||
->setFormat('d/MM/y') | |||
->setSortable(true), | |||
'title' => TextField::new('title')->setSortable(true), | |||
'newsletter' => AssociationField::new('newsletter')->setSortable(true), | |||
'image' => ImageManagerField::new('image'), | |||
'position' => NumberField::new('position'), | |||
'description' => TextEditorField::new('description'), | |||
'isSent' => BooleanField::new('isSent')->setSortable(true), | |||
]; | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
<?php | |||
namespace Lc\SovBundle\Definition\Field\Site; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition; | |||
use Lc\SovBundle\Field\CKEditorField; | |||
class PageFieldDefinition extends AbstractFieldDefinition | |||
{ | |||
public function configureIndex(): array | |||
{ | |||
return [ | |||
'id', | |||
'title', | |||
'status' | |||
]; | |||
} | |||
public function configurePanelMain(): array | |||
{ | |||
return [ | |||
'title', | |||
'description', | |||
'status' | |||
]; | |||
} | |||
public function configurePanels(): array | |||
{ | |||
return ['main', 'seo', 'conf']; | |||
} | |||
public function configureFields(): array | |||
{ | |||
return [ | |||
'title' => TextField::new('title')->setSortable(true), | |||
'description' => CKEditorField::new('description')->hideOnIndex(), | |||
]; | |||
} | |||
} |
@@ -15,10 +15,8 @@ use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | |||
*/ | |||
abstract class NewsModel extends AbstractFullEntity implements NewsInterface, OpenGraphInterface | |||
{ | |||
use OpenGraphTrait; | |||
/** | |||
* @ORM\Column(type="datetime") | |||
* @Gedmo\Timestampable(on="create") | |||
@@ -30,7 +28,6 @@ abstract class NewsModel extends AbstractFullEntity implements NewsInterface, Op | |||
*/ | |||
protected $isSent; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface") | |||
*/ |
@@ -118,10 +118,13 @@ entity: | |||
status: Statut | |||
email: Email | |||
value: Valeur | |||
metaTitle: Meta title | |||
metaTitle: "Meta : titre" | |||
metaTitle_help: Affiché dans les résultats de recherche Google | |||
metaDescription: Meta description | |||
metaDescription: "Meta : description" | |||
metaDescription_help: Affiché dans les résultats de recherche Google | |||
openGraphTitle: "Opengraph : titre" | |||
openGraphDescription: "Opengraph : description" | |||
openGraphImage: "Opengraph : image" | |||
oldUrls: Anciennes urls | |||
devAlias: Alias | |||
gallery: Galerie | |||
@@ -144,6 +147,7 @@ entity: | |||
configuration: Configuration | |||
gallery: Galerie | |||
seo: Référencement | |||
opengraph: Opengraph | |||
flashes: | |||
success: | |||
created: L'élément a bien été créé |
@@ -21,7 +21,7 @@ | |||
</div> | |||
{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | |||
{% block width %}8{% endblock %} | |||
{% block width %}12{% endblock %} | |||
{% block content %} | |||
{% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %} | |||
{{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }} |
@@ -20,7 +20,7 @@ | |||
</div> | |||
{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | |||
{% block width %}8{% endblock %} | |||
{% block width %}12{% endblock %} | |||
{% block content %} | |||
{% import '@LcSov/adminlte/macro/button.html.twig' as mbutton %} | |||
{{ mbutton.button({form: form_id, icon: 'fa fa-check'}) }} |
@@ -92,7 +92,7 @@ | |||
{% block form_footer %} | |||
{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %} | |||
{% block width %}8{% endblock %} | |||
{% block width %}12{% endblock %} | |||
{% block content %} | |||
{% for action in entity.actions %} | |||
{{ include(action.templatePath, { action: action }, with_context = false) }} |
@@ -100,7 +100,6 @@ | |||
<div class="content-wrapper" style="min-height: 554px;"> | |||
{% block content %} | |||
{% block content_header_wrapper %} | |||
<section class="content-header"> | |||
<div class="container-fluid"> | |||
<div class="row mb-2"> | |||
@@ -153,11 +152,15 @@ | |||
<section class="content"> | |||
<div class="container-fluid"> | |||
{% block main %}{% endblock %} | |||
{% if replace_content_with_message is defined %} | |||
<div class="alert alert-warning" role="alert"> | |||
{{ replace_content_with_message }} | |||
</div> | |||
{% else %} | |||
{% block main %}{% endblock %} | |||
{% endif %} | |||
</div> | |||
</section> | |||
{% endblock %} | |||
</div> | |||