Bläddra i källkod

Configuration SovSkeleton

master
Guillaume 3 år sedan
förälder
incheckning
154493ca86
39 ändrade filer med 6855 tillägg och 54 borttagningar
  1. +12
    -0
      assets/app.js
  2. +11
    -0
      assets/bootstrap.js
  3. +4
    -0
      assets/controllers.json
  4. +16
    -0
      assets/controllers/hello_controller.js
  5. +3
    -0
      assets/styles/app.css
  6. +1
    -0
      composer.json
  7. +72
    -1
      composer.lock
  8. +18
    -17
      config/bundles.php
  9. +5
    -0
      config/packages/artgris_file_manager.yaml
  10. +3
    -0
      config/packages/assets.yaml
  11. +4
    -4
      config/packages/doctrine.yaml
  12. +19
    -0
      config/packages/fos_ckeditor.yaml
  13. +3
    -0
      config/packages/lc_sov.yaml
  14. +2
    -0
      config/packages/liip_imagine.yaml
  15. +4
    -0
      config/packages/prod/webpack_encore.yaml
  16. +22
    -4
      config/packages/security.yaml
  17. +10
    -1
      config/packages/stof_doctrine_extensions.yaml
  18. +2
    -0
      config/packages/test/webpack_encore.yaml
  19. +2
    -2
      config/packages/translation.yaml
  20. +30
    -0
      config/packages/webpack_encore.yaml
  21. +2
    -11
      config/routes.yaml
  22. +51
    -0
      migrations/Version20210524094036.php
  23. +35
    -0
      migrations/Version20210524124412.php
  24. +24
    -0
      package.json
  25. +12
    -0
      public/.htaccess
  26. Binär
      public/assets/img/laclic.png
  27. +37
    -0
      src/Controller/Admin/DashboardController.php
  28. +44
    -0
      src/Controller/Admin/PageCrudController.php
  29. +15
    -0
      src/Controller/Admin/UserCrudController.php
  30. +30
    -0
      src/Controller/DefaultController.php
  31. +31
    -0
      src/Entity/File/File.php
  32. +98
    -0
      src/Entity/Site/Page.php
  33. +28
    -0
      src/Entity/User/User.php
  34. +21
    -0
      src/Repository/PageRepository.php
  35. +22
    -0
      symfony.lock
  36. +14
    -14
      templates/base.html.twig
  37. +17
    -0
      templates/index.html.twig
  38. +103
    -0
      webpack.config.js
  39. +6028
    -0
      yarn.lock

+ 12
- 0
assets/app.js Visa fil

@@ -0,0 +1,12 @@
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/

// any CSS you import will output into a single css file (app.css in this case)
import './styles/app.css';

// start the Stimulus application
import './bootstrap';

+ 11
- 0
assets/bootstrap.js Visa fil

@@ -0,0 +1,11 @@
import { startStimulusApp } from '@symfony/stimulus-bridge';

// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.(j|t)sx?$/
));

// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

+ 4
- 0
assets/controllers.json Visa fil

@@ -0,0 +1,4 @@
{
"controllers": [],
"entrypoints": []
}

+ 16
- 0
assets/controllers/hello_controller.js Visa fil

@@ -0,0 +1,16 @@
import { Controller } from 'stimulus';

/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

+ 3
- 0
assets/styles/app.css Visa fil

@@ -0,0 +1,3 @@
body {
background-color: lightgray;
}

+ 1
- 0
composer.json Visa fil

@@ -43,6 +43,7 @@
"symfony/twig-bundle": "^5.2",
"symfony/validator": "5.2.*",
"symfony/web-link": "5.2.*",
"symfony/webpack-encore-bundle": "^1.11",
"symfony/yaml": "5.2.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"

+ 72
- 1
composer.lock Visa fil

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a852596086b297542c6f9e1aedbe8893",
"content-hash": "362b468420cbd235c2e8ce5f78c859ad",
"packages": [
{
"name": "artgris/filemanager-bundle",
@@ -8244,6 +8244,77 @@
],
"time": "2021-03-07T15:51:33+00:00"
},
{
"name": "symfony/webpack-encore-bundle",
"version": "v1.11.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/webpack-encore-bundle.git",
"reference": "f282fb17ffa4839ba491eb7e3f5ffdd40c86f969"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/f282fb17ffa4839ba491eb7e3f5ffdd40c86f969",
"reference": "f282fb17ffa4839ba491eb7e3f5ffdd40c86f969",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"symfony/asset": "^4.4 || ^5.0",
"symfony/config": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0",
"symfony/service-contracts": "^1.0 || ^2.0"
},
"require-dev": {
"symfony/framework-bundle": "^4.4 || ^5.0",
"symfony/phpunit-bridge": "^4.4 || ^5.0",
"symfony/twig-bundle": "^4.4 || ^5.0",
"symfony/web-link": "^4.4 || ^5.0"
},
"type": "symfony-bundle",
"extra": {
"thanks": {
"name": "symfony/webpack-encore",
"url": "https://github.com/symfony/webpack-encore"
}
},
"autoload": {
"psr-4": {
"Symfony\\WebpackEncoreBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Integration with your Symfony app & Webpack Encore!",
"support": {
"issues": "https://github.com/symfony/webpack-encore-bundle/issues",
"source": "https://github.com/symfony/webpack-encore-bundle/tree/v1.11.2"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-04-26T12:48:17+00:00"
},
{
"name": "symfony/yaml",
"version": "v5.2.9",

+ 18
- 17
config/bundles.php Visa fil

@@ -1,21 +1,22 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
Artgris\Bundle\FileManagerBundle\ArtgrisFileManagerBundle::class => ['all' => true],
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
Lc\SovBundle\LcSovBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
Artgris\Bundle\FileManagerBundle\ArtgrisFileManagerBundle::class => ['all' => true],
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
Lc\SovBundle\LcSovBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];

+ 5
- 0
config/packages/artgris_file_manager.yaml Visa fil

@@ -0,0 +1,5 @@
artgris_file_manager:
conf:
default:
dir: "../public%app.path_uploads%"
type: 'image'

+ 3
- 0
config/packages/assets.yaml Visa fil

@@ -0,0 +1,3 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

+ 4
- 4
config/packages/doctrine.yaml Visa fil

@@ -1,10 +1,7 @@
doctrine:
dbal:
# IMPORTANT: DATABASE_URL *must* define the server version
url: '%env(resolve:DATABASE_URL)%'

# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
@@ -16,3 +13,6 @@ doctrine:
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
resolve_target_entities:
Lc\SovBundle\Model\User\UserInterface: App\Entity\User\User
Lc\SovBundle\Model\File\FileInterface: App\Entity\File\File

+ 19
- 0
config/packages/fos_ckeditor.yaml Visa fil

@@ -1,5 +1,24 @@
# Read the documentation: https://symfony.com/doc/current/bundles/FOSCKEditorBundle/index.html

fos_ck_editor:
input_sync: true
default_config: base_config
configs:
base_config:
filebrowserBrowseRoute: file_manager
filebrowserBrowseRouteParameters:
conf: default
module: ckeditor
format_tags: 'p;h2;h3'
toolbar:
- { name: "styles", items: ['Bold', 'Italic','Underline', 'Strike']}
- { name: "paragraph", items: ['Format', 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'] }
- { name: "link", items: [ 'Link', 'Unlink'] }
- {name: 'insert', items: [ 'Image' ]}
- {name: 'document', items: [ 'Source' ]}
simple_config:
toolbar:
- { items: ['Bold', 'Italic', 'Underline', 'Colors', 'Source'] }
twig:
form_themes:
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'

+ 3
- 0
config/packages/lc_sov.yaml Visa fil

@@ -0,0 +1,3 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
lc_sov:
homepage_route: 'app_homepage'

+ 2
- 0
config/packages/liip_imagine.yaml Visa fil

@@ -0,0 +1,2 @@
imports:
- { resource: liip_imagine/ }

+ 4
- 0
config/packages/prod/webpack_encore.yaml Visa fil

@@ -0,0 +1,4 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true

+ 22
- 4
config/packages/security.yaml Visa fil

@@ -1,15 +1,32 @@
security:
encoders:
App\Entity\User\User:
algorithm: auto

# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
users_in_memory: { memory: null }
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User\User
property: email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

main:
pattern: ^/
anonymous: true
lazy: true
provider: users_in_memory
provider: app_user_provider
guard:
authenticators:
- Lc\SovBundle\Authenticator\LoginFormAuthenticator
logout:
path: sov_logout
# where to redirect after logout
# target: app_any_route

# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
@@ -20,5 +37,6 @@ security:
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
- { path: ^/manager, roles: [ROLE_ADMIN, ROLE_SUPER_ADMIN] }
- { path: ^/admin, roles: [ROLE_ADMIN, ROLE_SUPER_ADMIN] }
- { path: ^/profile, roles: ROLE_USER }

+ 10
- 1
config/packages/stof_doctrine_extensions.yaml Visa fil

@@ -1,4 +1,13 @@
# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/
stof_doctrine_extensions:
default_locale: en_US
default_locale: '%app.default_locale%'
translation_fallback: true
orm:
default:
tree: true
timestampable: true # not needed: listeners are not enabled by default
sluggable: true
blameable: true
translatable: false


+ 2
- 0
config/packages/test/webpack_encore.yaml Visa fil

@@ -0,0 +1,2 @@
#webpack_encore:
# strict_mode: false

+ 2
- 2
config/packages/translation.yaml Visa fil

@@ -1,6 +1,6 @@
framework:
default_locale: en
default_locale: '%app.default_locale%'
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en
- '%app.default_locale%'

+ 30
- 0
config/packages/webpack_encore.yaml Visa fil

@@ -0,0 +1,30 @@
webpack_encore:
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false

# Set attributes that will be rendered on all script and link tags
script_attributes:
defer: true
# link_attributes:

# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'

# Preload all rendered script and link tags automatically via the HTTP/2 Link header
# preload: true

# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
# strict_mode: false

# If you have multiple builds:
# builds:
# pass "frontend" as the 3rg arg to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}

# frontend: '%kernel.project_dir%/public/frontend/build'

# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Put in config/packages/prod/webpack_encore.yaml
# cache: true

+ 2
- 11
config/routes.yaml Visa fil

@@ -2,19 +2,10 @@ sov_bundle:
resource: "@LcSovBundle/Resources/config/routes.yaml"
prefix: /

artgris_bundle_file_manager:
resource: "@ArtgrisFileManagerBundle/Controller"
type: annotation
prefix: /manager

admin_dashboard:
path: /admin
controller: App\Controller\Admin\DashboardController::index

home:
app_homepage:
path: /
defaults: { _controller: App\Controller\IndexController::index , _locale: fr }

page:
path: /page/{pageSlug}
controller: App\Controller\IndexController::page
defaults: { _controller: App\Controller\DefaultController::index , _locale: fr }

+ 51
- 0
migrations/Version20210524094036.php Visa fil

@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210524094036 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE file (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, path VARCHAR(255) DEFAULT NULL, legend VARCHAR(255) DEFAULT NULL, dev_alias VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, locales_enabled LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', position DOUBLE PRECISION NOT NULL, INDEX IDX_8C9F3610B03A8386 (created_by_id), INDEX IDX_8C9F3610896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE page (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, meta_title VARCHAR(255) DEFAULT NULL, meta_description LONGTEXT DEFAULT NULL, old_urls LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', slug VARCHAR(255) NOT NULL, position DOUBLE PRECISION NOT NULL, status DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, INDEX IDX_140AB6203DA5256D (image_id), INDEX IDX_140AB620B03A8386 (created_by_id), INDEX IDX_140AB620896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE page_file (page_id INT NOT NULL, file_id INT NOT NULL, INDEX IDX_B5B2ACAC4663E4 (page_id), INDEX IDX_B5B2ACA93CB796C (file_id), PRIMARY KEY(page_id, file_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, lastname VARCHAR(255) DEFAULT NULL, firstname VARCHAR(255) DEFAULT NULL, is_verified TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6203DA5256D FOREIGN KEY (image_id) REFERENCES file (id)');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE page_file ADD CONSTRAINT FK_B5B2ACAC4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE page_file ADD CONSTRAINT FK_B5B2ACA93CB796C FOREIGN KEY (file_id) REFERENCES file (id) ON DELETE CASCADE');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB6203DA5256D');
$this->addSql('ALTER TABLE page_file DROP FOREIGN KEY FK_B5B2ACA93CB796C');
$this->addSql('ALTER TABLE page_file DROP FOREIGN KEY FK_B5B2ACAC4663E4');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610B03A8386');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610896DBBDE');
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620B03A8386');
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620896DBBDE');
$this->addSql('DROP TABLE file');
$this->addSql('DROP TABLE page');
$this->addSql('DROP TABLE page_file');
$this->addSql('DROP TABLE user');
}
}

+ 35
- 0
migrations/Version20210524124412.php Visa fil

@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210524124412 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE page ADD file_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB62093CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
$this->addSql('CREATE INDEX IDX_140AB62093CB796C ON page (file_id)');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB62093CB796C');
$this->addSql('DROP INDEX IDX_140AB62093CB796C ON page');
$this->addSql('ALTER TABLE page DROP file_id');
}
}

+ 24
- 0
package.json Visa fil

@@ -0,0 +1,24 @@
{
"devDependencies": {
"@symfony/stimulus-bridge": "^2.0.0",
"@symfony/webpack-encore": "^1.0.0",
"core-js": "^3.0.0",
"regenerator-runtime": "^0.13.2",
"sass": "^1.34.0",
"stimulus": "^2.0.0",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
},
"dependencies": {
"admin-lte": "^3.1.0",
"jquery": "^3.6.0",
"sass-loader": "^11.1.1"
}
}

+ 12
- 0
public/.htaccess Visa fil

@@ -0,0 +1,12 @@
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>

Binär
public/assets/img/laclic.png Visa fil

Before After
Width: 523  |  Height: 106  |  Size: 9.8KB

+ 37
- 0
src/Controller/Admin/DashboardController.php Visa fil

@@ -0,0 +1,37 @@
<?php

namespace App\Controller\Admin;


use App\Entity\Common\TaxRate;
use App\Entity\Site\Page;
use App\Entity\User\GroupUser;
use App\Entity\User\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController;

class DashboardController extends SovDashboardController
{

public function configureMenuItems(): iterable
{
yield MenuItem::linkToDashboard('Tableau de bord', 'circle');

yield MenuItem::subMenu('Utilisateurs', 'user')->setSubItems(
[
MenuItem::linkToCrud('Utilisateurs', '', User::class),
]
);

yield MenuItem::linkToCrud('Pages', 'copy', Page::class);

yield MenuItem::subMenu('Mon compte', 'user')->setSubItems(
[
MenuItem::linkToRoute('Informations personnelles', '', 'sov_admin_account_profile'),
MenuItem::linkToRoute('Mot de passe', '', 'sov_admin_account_password'),
]
);
}
}

+ 44
- 0
src/Controller/Admin/PageCrudController.php Visa fil

@@ -0,0 +1,44 @@
<?php

namespace App\Controller\Admin;

use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\FileManagerField;
use Lc\SovBundle\Field\GalleryManagerField;
use Lc\SovBundle\Field\ImageManagerField;
use Lc\SovBundle\Field\StatusField;

class PageCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return Page::class;
}

public function configureFields(string $pageName): iterable
{
$panel = parent::configureFields($pageName);

return array_merge(
[
FormField::addPanel('Général'),
TextField::new('title'),
NumberField::new('position')->hideOnForm(),
CKEditorField::new('description'),
FileManagerField::new('file'),
StatusField::new('status'),
FormField::addPanel('Galerie'),
GalleryManagerField::new('gallery')
],
$panel
);
}


}

+ 15
- 0
src/Controller/Admin/UserCrudController.php Visa fil

@@ -0,0 +1,15 @@
<?php

namespace App\Controller\Admin;

use App\Entity\User\User;
use Lc\SovBundle\Controller\Admin\UserCrudController as AbstractUserCrudController;

class UserCrudController extends AbstractUserCrudController
{
public static function getEntityFqcn(): string
{
return User::class;
}

}

+ 30
- 0
src/Controller/DefaultController.php Visa fil

@@ -0,0 +1,30 @@
<?php

namespace App\Controller;

use App\Entity\Site\Page;
use Lc\SovBundle\Doctrine\EntityManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;


class DefaultController extends AbstractController
{
protected $em;
protected $mailer;

public function __construct(EntityManager $em)
{
$this->em = $em;
}

public function index(): Response
{
$pageRepository = $this->em->getRepository(Page::class);
$pages = $pageRepository->findAll();

return $this->render('index.html.twig', [
'pages' => $pages
]);
}
}

+ 31
- 0
src/Entity/File/File.php Visa fil

@@ -0,0 +1,31 @@
<?php

namespace App\Entity\File;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Model\File\FileInterface;
use Lc\SovBundle\Model\File\FileModel;
use Lc\SovBundle\Repository\File\FileRepository;

/**
* @ORM\Entity(repositoryClass=FileRepository::class)
*/
class File extends FileModel implements FileInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;

public function getId(): ?int
{
return $this->id;
}

public function __toString()
{
return ''.$this->getLegend() ;
}
}

+ 98
- 0
src/Entity/Site/Page.php Visa fil

@@ -0,0 +1,98 @@
<?php

namespace App\Entity\Site;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use App\Entity\File\File ;
use App\Repository\PageRepository;

/**
* @ORM\Entity(repositoryClass=PageRepository::class)
*/
class Page extends AbstractFullEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;

/**
* @ORM\ManyToOne(targetEntity=File::class, cascade={"persist", "remove"})
*/
private $image;

/**
* @ORM\ManyToMany(targetEntity=File::class, cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"position" = "ASC"})
*/
private $gallery;

/**
* @ORM\ManyToOne(targetEntity=File::class, cascade={"persist"})
*/
private $file;

public function __construct()
{
$this->gallery = new ArrayCollection();
}

public function getId(): ?int
{
return $this->id;
}

public function getImage(): ?File
{
return $this->image;
}

public function setImage(?File $image): self
{
$this->image = $image;

return $this;
}

/**
* @return Collection|File[]
*/
public function getGallery(): Collection
{
return $this->gallery;
}

public function addGallery(File $gallery): self
{
if (!$this->gallery->contains($gallery)) {
$this->gallery[] = $gallery;
}

return $this;
}

public function removeGallery(File $gallery): self
{
$this->gallery->removeElement($gallery);

return $this;
}

public function getFile(): ?File
{
return $this->file;
}

public function setFile(?File $file): self
{
$this->file = $file;

return $this;
}

}

+ 28
- 0
src/Entity/User/User.php Visa fil

@@ -0,0 +1,28 @@
<?php

namespace App\Entity\User;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Model\User\User as SovUserModel;
use Lc\SovBundle\Model\User\UserInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
* @ORM\Entity(repositoryClass="Lc\SovBundle\Repository\User\UserRepository")
* @UniqueEntity(fields={"email"}, message="There is already an account with this email")
*/
class User extends SovUserModel implements UserInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;

public function getId(): ?int
{
return $this->id;
}

}

+ 21
- 0
src/Repository/PageRepository.php Visa fil

@@ -0,0 +1,21 @@
<?php

namespace App\Repository;

use App\Entity\Site\Page;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method Page|null find($id, $lockMode = null, $lockVersion = null)
* @method Page|null findOneBy(array $criteria, array $orderBy = null)
* @method Page[] findAll()
* @method Page[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PageRepository extends AbstractRepository
{
public function getInterfaceClass()
{
return Page::class;
}

}

+ 22
- 0
symfony.lock Visa fil

@@ -572,6 +572,28 @@
"config/routes/dev/web_profiler.yaml"
]
},
"symfony/webpack-encore-bundle": {
"version": "1.9",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.9",
"ref": "9399a0bfc6ee7a0c019f952bca46d6a6045dd451"
},
"files": [
"assets/app.js",
"assets/bootstrap.js",
"assets/controllers.json",
"assets/controllers/hello_controller.js",
"assets/styles/app.css",
"config/packages/assets.yaml",
"config/packages/prod/webpack_encore.yaml",
"config/packages/test/webpack_encore.yaml",
"config/packages/webpack_encore.yaml",
"package.json",
"webpack.config.js"
]
},
"symfony/yaml": {
"version": "v5.2.9"
},

+ 14
- 14
templates/base.html.twig Visa fil

@@ -1,19 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{# Run `composer require symfony/webpack-encore-bundle`
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome !{% endblock %}</title>
{# Run `composer require symfony/webpack-encore-bundle`
and uncomment the following Encore helpers to start using Symfony UX #}
{% block stylesheets %}
{#{{ encore_entry_link_tags('app') }}#}
{% endblock %}
{% block stylesheets %}
{# {{ encore_entry_link_tags('app') }} #}
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}

{% block javascripts %}
{#{{ encore_entry_script_tags('app') }}#}
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
</body>
{% block javascripts %}
{# {{ encore_entry_script_tags('app') }} #}
{% endblock %}
</body>
</html>

+ 17
- 0
templates/index.html.twig Visa fil

@@ -0,0 +1,17 @@
{% extends 'base.html.twig' %}

{% block body %}
<h1>SovSkeleton</h1>
<ul>
{% for page in pages %}
<li>
<h2>{{ page.title }}</h2>
{% if page.gallery is defined %}
{% for image in page.gallery %}
<img src="{{ lc_liip(image.path, 'thumbnail') }}" alt="{{ image.legend }}" />
{% endfor %}
{% endif %}
</li>
{% endfor %}
</ul>
{% endblock body %}

+ 103
- 0
webpack.config.js Visa fil

@@ -0,0 +1,103 @@
const Encore = require('@symfony/webpack-encore');

// Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file.
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}

const path = require('path');

Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
// only needed for CDN's or sub-directory deploy
//.setManifestKeyPrefix('build/')
.enableSassLoader()
.addAliases({
'core-js': path.join(__dirname, 'node_modules/core-js'),
'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery'),
'jquery-ui': path.join(__dirname, 'node_modules/jquery-ui-dist/jquery-ui'),
'adminlte-js': path.join(__dirname, 'node_modules/admin-lte/dist/js/adminlte.min.js'),
'adminlte-css': path.join(__dirname, 'node_modules/admin-lte/build/scss/adminlte.scss'),
'fontawesome-css': path.join(__dirname, 'node_modules/admin-lte/plugins/fontawesome-free/css/all.css'),
'adminlte-plugin': path.join(__dirname, 'node_modules/admin-lte/plugins/'),
'toastr': path.join(__dirname, 'node_modules/toastr'),

/*'adminlte': path.resolve(__dirname, './node_modules/admin-lte/dist/js/adminlte.min.js'),
'adminltePlugin': path.resolve(__dirname, './node_modules/admin-lte/plugins/'),
'admin-lte-css': path.resolve(__dirname, './node_modules/admin-lte/dist/css/adminlte.css'),
'core-js': path.resolve(__dirname, './node_modules/core-js'),
'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery'),
'select2': path.join(__dirname, 'node_modules/select2/dist/js/select2.js'),
'select2-css': path.join(__dirname, 'node_modules/select2/dist/css/select2.min.css'),*/
//'select2-bootstrap-theme': path.join(__dirname, 'node_modules/select2-bootstrap-5-theme/dist/select2-bootstrap-5-theme.min.css')
})

/*
* ENTRY CONFIG
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
*/
.addEntry('adminlte-common', './Lc/SovBundle/Resources/assets/app/adminlte/common/app.common.js')
.addEntry('adminlte-index', './Lc/SovBundle/Resources/assets/app/adminlte/index/app.index.js')
.addEntry('adminlte-form', './Lc/SovBundle/Resources/assets/app/adminlte/form/app.form.js')
.addEntry('adminlte-sort', './Lc/SovBundle/Resources/assets/app/adminlte/sort/app.sort.js')
.addEntry('adminlte-field-filemanager', './Lc/SovBundle/Resources/assets/app/adminlte/field/filemanager/app.filemanager.js')
.addEntry('adminlte-field-collection', './Lc/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js')

// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')

// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()

// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()

/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())

.configureBabel((config) => {
config.plugins.push('@babel/plugin-proposal-class-properties');
})

// enables @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
})


// enables Sass/SCSS support
//.enableSassLoader()

// uncomment if you use TypeScript
//.enableTypeScriptLoader()

// uncomment if you use React
//.enableReactPreset()

// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
//.enableIntegrityHashes(Encore.isProduction())

// uncomment if you're having problems with a jQuery plugin
//.autoProvidejQuery()
;

module.exports = Encore.getWebpackConfig();

+ 6028
- 0
yarn.lock
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


Laddar…
Avbryt
Spara