diff --git a/.gitignore b/.gitignore index eaa3cd3..ba27aaf 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,10 @@ .phpunit.result.cache /phpunit.xml ###< symfony/phpunit-bridge ### + +###> symfony/webpack-encore-bundle ### +/node_modules/ +/public/build/ +npm-debug.log +yarn-error.log +###< symfony/webpack-encore-bundle ### diff --git a/.idea/giftopic.iml b/.idea/giftopic.iml index 679bf37..398b515 100644 --- a/.idea/giftopic.iml +++ b/.idea/giftopic.iml @@ -111,6 +111,7 @@ + @@ -120,5 +121,6 @@ + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index 83d1fa0..31cdcdc 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index 42695f1..4a15e1f 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -112,6 +112,7 @@ + diff --git a/.idea/sshConfigs.xml b/.idea/sshConfigs.xml new file mode 100644 index 0000000..6f9427c --- /dev/null +++ b/.idea/sshConfigs.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 0000000..fb0d65a --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/assets/css/app.scss b/assets/css/app.scss new file mode 100644 index 0000000..ed1a532 --- /dev/null +++ b/assets/css/app.scss @@ -0,0 +1,30 @@ +@import "~bootstrap/scss/bootstrap"; + +@font-face { + font-family: Gabriola; + font-style: normal; + font-weight: normal; + src: local('Gabriola'), url('/build/static/fonts/gabriola.woff') format('woff'); +} +@font-face { + font-family: BlackChancery; + font-style: normal; + font-weight: normal; + src: local('BlackChancery'), url('/build/static/fonts/black_chancery.ttf') format('truetype'); +} + +#messages { + display: none; +} + +body { + font-family: Gabriola, sans-serif; + font-size: 1.5rem; + margin : 120px 5px 0 5px; +} +.ui-widget { + font-family: Gabriola, sans-serif; + font-size: 1.5rem; +} + +@import "header"; \ No newline at end of file diff --git a/assets/css/header.scss b/assets/css/header.scss new file mode 100644 index 0000000..acc9cf0 --- /dev/null +++ b/assets/css/header.scss @@ -0,0 +1,13 @@ +header { + position : fixed; + top : 0; + left : 0; + width : 100%; + background : rgba(255, 255, 255, 1); +} + +#logo { + font-family : BlackChancery, sans-serif; + font-size : 3em; + margin-left: 10px; +} \ No newline at end of file diff --git a/public/javascript/site/base.js b/assets/js/app.js similarity index 56% rename from public/javascript/site/base.js rename to assets/js/app.js index 6d97ce0..2aa285a 100644 --- a/public/javascript/site/base.js +++ b/assets/js/app.js @@ -1,3 +1,8 @@ +require('../css/app.scss'); + +const $ = require('jquery'); +require('jquery-ui'); + $(function () { /* Messages */ $('#messages div').each(function () { diff --git a/assets/static/fonts/black_chancery.ttf b/assets/static/fonts/black_chancery.ttf new file mode 100644 index 0000000..cca5091 Binary files /dev/null and b/assets/static/fonts/black_chancery.ttf differ diff --git a/assets/static/fonts/gabriola.woff b/assets/static/fonts/gabriola.woff new file mode 100644 index 0000000..729d981 Binary files /dev/null and b/assets/static/fonts/gabriola.woff differ diff --git a/besoin.txt b/besoin.txt index 582b741..f975a95 100644 --- a/besoin.txt +++ b/besoin.txt @@ -1,3 +1,5 @@ +=== DEV === + Gestion de comptes utilisateurs : *login, *pass, *Nom, *prénom, photo, genre (homme / femme), langue Gestion de liens entre les utilsateurs ("connaissances") avec validation des deux côtés (genre demande d'amis) Gestion des notification : sous-table avec un "type" de notif (liste en dur) avec deux case à cocher : alerte (sur le site), mail diff --git a/composer.json b/composer.json index 7290843..8b9504a 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,8 @@ "php": "^7.4.2", "ext-ctype": "*", "ext-iconv": "*", - "ext-sodium": "^7.4", "ext-intl": "^7.4", + "ext-sodium": "^7.4", "sensio/framework-extra-bundle": "^5.5", "symfony/apache-pack": "^1.0", "symfony/asset": "5.0.*", @@ -31,6 +31,7 @@ "symfony/twig-pack": "^1.0", "symfony/validator": "5.0.*", "symfony/web-link": "5.0.*", + "symfony/webpack-encore-bundle": "^1.7", "symfony/yaml": "5.0.*" }, "require-dev": { diff --git a/composer.lock b/composer.lock index d15a5df..4c50ae8 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "4f8479cf71ad173ba0d6fe9db046b670", + "content-hash": "1bcd31f379ab59563b21f4065658e28c", "packages": [ { "name": "doctrine/annotations", @@ -6060,6 +6060,59 @@ "homepage": "https://symfony.com", "time": "2020-04-28T17:58:55+00:00" }, + { + "name": "symfony/webpack-encore-bundle", + "version": "v1.7.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/webpack-encore-bundle.git", + "reference": "5c0f659eceae87271cce54bbdfb05ed8ec9007bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/5c0f659eceae87271cce54bbdfb05ed8ec9007bd", + "reference": "5c0f659eceae87271cce54bbdfb05ed8ec9007bd", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/asset": "^3.4 || ^4.0 || ^5.0", + "symfony/config": "^3.4 || ^4.0 || ^5.0", + "symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0", + "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0", + "symfony/service-contracts": "^1.0 || ^2.0" + }, + "require-dev": { + "symfony/framework-bundle": "^3.4 || ^4.0 || ^5.0", + "symfony/phpunit-bridge": "^4.3.5 || ^5.0", + "symfony/twig-bundle": "^3.4 || ^4.0 || ^5.0", + "symfony/web-link": "^3.4 || ^4.0 || ^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!", + "time": "2020-01-31T15:31:59+00:00" + }, { "name": "symfony/yaml", "version": "v5.0.8", @@ -6829,8 +6882,8 @@ "php": "^7.4.2", "ext-ctype": "*", "ext-iconv": "*", - "ext-sodium": "^7.4", - "ext-intl": "^7.4" + "ext-intl": "^7.4", + "ext-sodium": "^7.4" }, "platform-dev": [] } diff --git a/config/bundles.php b/config/bundles.php index 9e19289..29d5d94 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -12,4 +12,5 @@ return [ Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], ]; diff --git a/config/packages/assets.yaml b/config/packages/assets.yaml new file mode 100644 index 0000000..051d36d --- /dev/null +++ b/config/packages/assets.yaml @@ -0,0 +1,3 @@ +framework: + assets: + json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' diff --git a/config/packages/prod/webpack_encore.yaml b/config/packages/prod/webpack_encore.yaml new file mode 100644 index 0000000..d0b3ba8 --- /dev/null +++ b/config/packages/prod/webpack_encore.yaml @@ -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 diff --git a/config/packages/test/webpack_encore.yaml b/config/packages/test/webpack_encore.yaml new file mode 100644 index 0000000..02a7651 --- /dev/null +++ b/config/packages/test/webpack_encore.yaml @@ -0,0 +1,2 @@ +#webpack_encore: +# strict_mode: false diff --git a/config/packages/webpack_encore.yaml b/config/packages/webpack_encore.yaml new file mode 100644 index 0000000..9191f4f --- /dev/null +++ b/config/packages/webpack_encore.yaml @@ -0,0 +1,25 @@ +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 + + # 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 http2 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 diff --git a/config/routes.yaml b/config/routes.yaml index 7e8fe18..559eb0a 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -3,6 +3,6 @@ index: path: / controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController defaults: - route: 'app_external_index' + route: 'app_site_index' _locale: '%kernel.default_locale%' permanent: true \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..d7bbcce --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "devDependencies": { + "@symfony/webpack-encore": "^0.29.0", + "bootstrap": "^4.4.1", + "copy-webpack-plugin": "^6.0.1", + "core-js": "^3.0.0", + "node-sass": "^4.14.1", + "regenerator-runtime": "^0.13.2", + "sass-loader": "^7.0.1", + "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": { + "jquery": "^3.5.1", + "jquery-ui": "^1.12.1" + } +} diff --git a/public/.htaccess b/public/.htaccess index 0379bfc..33b5e42 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,3 +1,311 @@ +# Apache configuration file + +# ---------------------------------------------------------------------- +# Better website experience for IE users +# ---------------------------------------------------------------------- + +# Force the latest IE version, in various cases when it may fall back to IE7 mode +# github.com/rails/rails/commit/123eb25#commitcomment-118920 +# Use ChromeFrame if it's installed for a better experience for the poor IE folk + + Header set X-UA-Compatible "IE=Edge,chrome=1" + # mod_headers can't match by content-type, but we don't want to send this header on *everything*... + + Header unset X-UA-Compatible + + + +# ---------------------------------------------------------------------- +# Cross-domain AJAX requests +# ---------------------------------------------------------------------- +# Serve cross-domain Ajax requests, disabled by default. +# enable-cors.org +# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity + +# +# Header set Access-Control-Allow-Origin "*" +# + +# ---------------------------------------------------------------------- +# CORS-enabled images (@crossorigin) +# ---------------------------------------------------------------------- +# Send CORS headers if browsers request them; enabled by default for images. +# developer.mozilla.org/en/CORS_Enabled_Image +# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html +# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ +# wiki.mozilla.org/Security/Reviews/crossoriginAttribute + + + + # mod_headers, y u no match by Content-Type?! + + SetEnvIf Origin ":" IS_CORS + Header set Access-Control-Allow-Origin "*" env=IS_CORS + + + + +# ---------------------------------------------------------------------- +# Webfont access +# ---------------------------------------------------------------------- + +# Allow access from all domains for webfonts. +# Alternatively you could only whitelist your +# subdomains like "subdomain.example.com". + + + + Header set Access-Control-Allow-Origin "*" + + + + + +# ---------------------------------------------------------------------- +# Proper MIME type for all files +# ---------------------------------------------------------------------- + +# JavaScript +# Normalize to standard type (it's sniffed in IE anyways) +# tools.ietf.org/html/rfc4329#section-7.2 +AddType application/javascript js + +# Audio +AddType audio/ogg oga ogg +AddType audio/mp4 m4a + +# Video +AddType video/ogg ogv +AddType video/mp4 mp4 m4v +AddType video/webm webm + +# SVG +# Required for svg webfonts on iPad +# twitter.com/FontSquirrel/status/14855840545 +AddType image/svg+xml svg svgz +AddEncoding gzip svgz + +# Webfonts +AddType application/vnd.ms-fontobject eot +AddType application/x-font-ttf ttf ttc +AddType font/opentype otf +AddType application/x-font-woff woff + +# Assorted types +AddType image/x-icon ico +AddType image/webp webp +AddType text/cache-manifest appcache manifest +AddType text/x-component htc +AddType application/x-chrome-extension crx +AddType application/x-opera-extension oex +AddType application/x-xpinstall xpi +AddType application/octet-stream safariextz +AddType application/x-web-app-manifest+json webapp +AddType text/x-vcard vcf + + + +# ---------------------------------------------------------------------- +# Gzip compression +# ---------------------------------------------------------------------- + + + # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ + + + SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding + RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding + + + + # HTML, TXT, CSS, JavaScript, JSON, XML, HTC: + + + = 2.4> + FilterDeclare COMPRESS + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/html'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/css'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/plain'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/xml'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/x-component'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/javascript'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/json'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/xml'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/xhtml+xml'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/rss+xml'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/atom+xml'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/vnd.ms-fontobject'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'image/svg+xml'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'image/x-icon'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/x-font-ttf'" + FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'font/opentype'" + FilterChain COMPRESS + FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no + + + FilterDeclare COMPRESS + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject + FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml + FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf + FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype + FilterChain COMPRESS + FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no + + + + + + + # Legacy versions of Apache + AddOutputFilterByType DEFLATE text/html text/plain text/css application/json + AddOutputFilterByType DEFLATE application/javascript + AddOutputFilterByType DEFLATE text/xml application/xml text/x-component + AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml + AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype + + + + + +# ---------------------------------------------------------------------- +# Expires headers (for better cache control) +# ---------------------------------------------------------------------- + +# These are pretty far-future expires headers. +# They assume you control versioning with cachebusting query params like +# - - - {% block javascripts %}{% endblock %} + {% block javascripts %} + {{ encore_entry_script_tags('app') }} + {% endblock %} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..1b68c7b --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,87 @@ +var Encore = require('@symfony/webpack-encore'); + +const CopyWebpackPlugin = require('copy-webpack-plugin'); + +// 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'); +} + +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/') + + .addPlugin(new CopyWebpackPlugin( + { + patterns: [ + { + from: './assets/static', + to: 'static', + }, + ], + }, + )) + + /* + * ENTRY CONFIG + * + * Add 1 entry for each "page" of your app + * (including one that's included on every page - e.g. "app") + * + * 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('app', './assets/js/app.js') + //.addEntry('page1', './assets/js/page1.js') + //.addEntry('page2', './assets/js/page2.js') + + // 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()) + + // 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 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() + +// uncomment if you use API Platform Admin (composer req api-admin) +//.enableReactPreset() +//.addEntry('admin', './assets/js/admin.js') +; + +module.exports = Encore.getWebpackConfig();