melange/cms

This package is abandoned and no longer maintained. No replacement package was suggested.

Melange CmsBundle

Installs: 125

Dependents: 0

Suggesters: 0

Security: 0

Type:symfony-bundle

dev-master 2021-02-12 08:01 UTC

This package is auto-updated.

Last update: 2021-02-23 05:44:01 UTC


README

php -d memory_limit=-1 composer.phar

// -----------------------------------

symfony new <project-name> --full

// -----------------------------------

bundles.php:

Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], FOS\UserBundle\FOSUserBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Melange\CmsBundle\MelangeCmsBundle::class => ['all' => true],

// -----------------------------------

package.json:

{ "devDependencies": {

"bootstrap": "^4.5.0",
"jquery": "^3.5.1",
"node-sass": "^4.13.0",
"popper.js": "^1.16.1",
"font-awesome": "^4.7.0",
"jquery-datetimepicker": "^2.5.21",
"js-cookie": "^2.2.1",
"scrollpos-styler": "^0.7.1",
"sass-loader": "^8.0.2",
"select2": "^4.0.13",

} }

"@ttskch/select2-bootstrap4-theme": "github:ttskch/select2-bootstrap4-theme"

webpack.config.js:

var path = require('path');

.addEntry('cms', './vendor/melange/cms/Resources/js/cms.js') .addStyleEntry('light-mode', './vendor/melange/cms/Resources/css/light-mode.scss') .addStyleEntry('dark-mode', './vendor/melange/cms/Resources/css/dark-mode.scss')

.addAliases({

    'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery')
})

.enableSassLoader()

// -----------------------------------

Create a class that extends Melange\CmsBundle\Twig\CmsExtension

config/packages/melange_cms.yml:

melange_cms: twig_extension: App\Twig\AppExtension

// -----------------------------------

fos_user.yaml:

fos_user:

db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: Melange\CmsBundle\Entity\User
from_email:
    address: "%env(resolve:MAILER_USER)%"
    sender_name: "%env(resolve:MAILER_USER)%"
service:
     mailer: fos_user.mailer.twig_swift

// -----------------------------------

routes.yml:

fos_user_security:

resource: "@FOSUserBundle/Resources/config/routing/security.xml"

melange_cms_routes:

# loads routes from the given routing file stored in some bundle
resource: '@MelangeCmsBundle/Controller/'
type:     annotation

// -----------------------------------

packages/twig.yml:

form_themes: ['bootstrap_4_horizontal_layout.html.twig'] globals:

    app_name: BANMAN
    copyright: The Factory

// -----------------------------------

packages/security.yml:

security:

encoders:
    FOS\UserBundle\Model\UserInterface: bcrypt

role_hierarchy:
    ROLE_USER: ROLE_USER
    ROLE_ADMIN: ROLE_ADMIN

providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    main:
        pattern: ^/
        user_checker: security.user_checker
        form_login:
            provider: fos_userbundle
            csrf_token_generator: security.csrf.token_manager

        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/<a cms-section>, role: ROLE_USER }
    - { path: ^/cms/user, role: ROLE_ADMIN }

// -----------------------------------

doctrine.yml:

doctrine:

dbal:
    url: '%env(resolve:DATABASE_URL)%'

    # IMPORTANT: You MUST configure your db driver and server version,
    # either here or in the DATABASE_URL env var (see .env file)
    #driver: 'mysql'
    #server_version: '5.7'

    # Only needed for MySQL (ignored otherwise)
    charset: utf8mb4
    default_table_options:
        collate: utf8mb4_unicode_ci
orm:
    auto_generate_proxy_classes: true
    naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
    auto_mapping: true
    mappings:
        App:
            is_bundle: false
            type: annotation
            dir: '%kernel.project_dir%/src/Entity'
            prefix: 'App\Entity'
            alias: App
        gedmo_loggable:
            type: annotation
            prefix: Gedmo\Loggable\Entity
            dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
            alias: GedmoLoggable # (optional) it will default to the name set for the mapping
            is_bundle: false    
            

// -----------------------------------

stof_doctrine_extensions.yaml

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
orm:
    default:
        loggable: true
        timestampable: true

// -----------------------------------

twig.yaml:

globals:

copyright: APT

// -----------------------------------

php bin/console doctrine:schema:update --force

php bin/console fos:user:create jeroen test@example.com jeroen ; php bin/console fos:user:promote jeroen ROLE_ADMIN