-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.0.1' into main
- Loading branch information
Showing
52 changed files
with
2,882 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Flash Info Bundle code review | ||
|
||
on: | ||
push: | ||
branches: [ "main", "develop" ] | ||
pull_request: | ||
branches: [ "main", "develop" ] | ||
|
||
jobs: | ||
review: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | ||
with: | ||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, zip | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress | ||
|
||
- name: Check for vulnerabilities | ||
uses: symfonycorp/security-checker-action@v4 | ||
|
||
- name: Run Easy Coding Standard | ||
run: vendor/bin/ecs check src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vendor | ||
var | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# Sulu Flash Info Bundle | ||
|
||
![GitHub release (with filter)](https://img.shields.io/github/v/release/Pixel-Developpement/sulu-flashinfobundle) | ||
[![Dependency](https://img.shields.io/badge/sulu-2.5-cca000.svg)](https://sulu.io/) | ||
|
||
## Presentation | ||
|
||
A bundle for the Sulu CMS that allows you to manage flash information displayed with a modal. | ||
|
||
![](src/Resources/documentation/presentation.jpg) | ||
|
||
## Features | ||
|
||
- program your newsflashes | ||
- modal in vanilla js (thank you Tingle https://tingle.robinparisi.com/) | ||
- twig functions to display news flashes | ||
|
||
## Requirement | ||
|
||
* PHP >= 8.0 | ||
* Sulu >= 2.5 | ||
* Symfony >= 5.4 | ||
* Composer | ||
|
||
## Installation | ||
|
||
### Install the bundle | ||
|
||
Execute the following [composer](https://getcomposer.org/) command to add the bundle to the dependencies of your | ||
project: | ||
|
||
```bash | ||
composer require pixelopen/sulu-flashinfobundle | ||
``` | ||
|
||
### Enable the bundle | ||
|
||
Enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project: | ||
|
||
```php | ||
return [ | ||
/* ... */ | ||
Pixel\FlashInfoBundle\FlashInfoBundle::class => ['all' => true], | ||
]; | ||
``` | ||
|
||
### Update schema | ||
|
||
For the development environment: | ||
|
||
```shell script | ||
bin/console do:sch:up --force | ||
``` | ||
|
||
For the production environment: use doctrine migration | ||
|
||
## Bundle Config | ||
|
||
Define the Admin Api Route in `routes_admin.yaml` | ||
```yaml | ||
flash_info.flash_infos_api: | ||
type: rest | ||
prefix: /admin/api | ||
resource: pixel_flashinfo.flash-infos_route_controller | ||
name_prefix: flashinfo. | ||
|
||
flash_info.setting_api: | ||
type: rest | ||
prefix: /admin/api | ||
resource: pixel_flashinfo.setting_route_controller | ||
name_prefix: flashinfo. | ||
``` | ||
## Use | ||
### Add/Edit a news flash | ||
To add a news flash, go to the "News flash" section and then, click on Add on the top of the page. | ||
Once on the form, fill the following fields: | ||
- Title (mandatory) | ||
- Image | ||
- Documents | ||
- Start date (mandatory) | ||
- End date (mandatory) | ||
- Description (mandatory) | ||
- Button label | ||
- Link | ||
![](src/Resources/documentation/form_add.png) | ||
Click on "Save" to save your news flash. To enable it, click on the "Active?" button on the top of the page. | ||
To edit a news flash, click on the pencil of the news flash you wish to edit. This will take you to the same form as the add one. | ||
![](src/Resources/documentation/list.png) | ||
### Remove/Restore | ||
There are 2 ways to delete a news flash: | ||
- Go the edit form and click on the "Delete" button on the top of the page | ||
- Check the news flash you want to delete and click on "Delete" on the top if the page | ||
In both cases, the deleted news flash will be placed in the trash. | ||
To restore a news flash, go to Settings > Trash and select the news flash you want to restore (by clicking on the reverse clock on the left). | ||
After the restoration, you will be redirected to the edit for. | ||
![](src/Resources/documentation/trash.png) | ||
To permanently delete a news flash, select it and click on the "Delete" button on the top of the page. | ||
### Settings | ||
The settings allow you to set up how the news flash modal should be displayed. | ||
To access it, go to Settings > Newsflash management. You will have a select with the following options: | ||
- Do not open: the modal is never opened automatically | ||
- Open once: the modal is open on the first visit of the site (stored in a cookie) | ||
- Open every time: the modal is opened each time during the user's visit | ||
![](src/Resources/documentation/settings.png) | ||
## Display modal | ||
The modal will display the news flashes that are active with the current date in the period defined by the news flash. | ||
The modal can be displayed automatically or by clicking a button. | ||
### Add the automatic modal opening | ||
To use the automatic opening news flash modal, add the auto_display_flash_info_modal function to the head tag. | ||
This function don't take any parameter. | ||
```twig | ||
<head> | ||
{{ auto_display_flash_info_modal() }} | ||
</head> | ||
``` | ||
|
||
This Twig function will automatically display the modal according to the modal display policy (set in the settings) if there are published news flashes. | ||
|
||
### Add the modal opening on click | ||
|
||
To use the modal opening on click, you need to use the display_flash_info_modal_on_click function. | ||
|
||
This function must be placed in the head tag and takes one parameter: | ||
- elementId: the id of the element that open the modal | ||
|
||
```twig | ||
<head> | ||
{{ display_flash_info_modal_on_click('flashInfo') }} | ||
</head> | ||
<body> | ||
<button id="flashInfo">Open the news flashes</button> | ||
</body> | ||
``` | ||
|
||
This will display the modal no matter what the modal display policy is. | ||
|
||
If there is no active news flash, an empty message will be shown. | ||
|
||
## Contributing | ||
You can contribute to this bundle. The only thing you must do is respect the coding standard we implement. | ||
You can find them in the `ecs.php` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "pixelopen/sulu-flashinfobundle", | ||
"type": "sulu-bundle", | ||
"description": "Flash info bundle for Sulu", | ||
"keywords": [ | ||
"sulu", | ||
"suluCms" | ||
], | ||
"homepage": "https://github.com/Pixel-Open/sulu-flashinfobundle", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Pixel Developpement" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.0", | ||
"sulu/sulu": "^2.5", | ||
"symfony/config": "^5.0 || ^6.0", | ||
"symfony/dependency-injection": "^5.0 || ^6.0", | ||
"symfony/framework-bundle": "^5.0 || ^6.0", | ||
"symfony/http-foundation": "^5.0 || ^6.0", | ||
"symfony/http-kernel": "^5.0 || ^6.0" | ||
}, | ||
"require-dev": { | ||
"dantleech/phpcr-migrations-bundle": "^1.3", | ||
"jackalope/jackalope-doctrine-dbal": "^1.3.2", | ||
"phpstan/phpstan": "^1.11", | ||
"symplify/easy-coding-standard": "^12.3" | ||
}, | ||
"scripts": { | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Pixel\\FlashInfoBundle\\": "src" | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"php-http/discovery": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; | ||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
use Symplify\EasyCodingStandard\ValueObject\Set\SetList; | ||
|
||
return static function (ECSConfig $ecsConfig): void { | ||
$ecsConfig->paths([__DIR__ . '/src']); | ||
$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [ | ||
'syntax' => 'short', | ||
]); | ||
|
||
$ecsConfig->sets([ | ||
// run and fix, one by one | ||
//SetList::SPACES, | ||
SetList::ARRAY, | ||
SetList::DOCBLOCK, | ||
SetList::PSR_12, | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
parameters: | ||
level: 6 | ||
|
||
treatPhpDocTypesAsCertain: false | ||
|
||
paths: | ||
- src | ||
|
||
ignoreErrors: | ||
- | ||
identifier: missingType.generics |
Oops, something went wrong.