Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next release #62

Merged
merged 54 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b87f8b1
fix: allow defining custom sort-tests
tuxes3 May 15, 2024
2a8dd7e
fix(content/ajax): Fix replace content
ArnoEgli May 6, 2024
59c9c2d
feat: Add dropdown action
ArnoEgli May 6, 2024
d2f89cd
fix: push button of dashboard cards all the way to the bottom
marcwieland95 May 14, 2024
779d820
fix: inherit svg color from class
marcwieland95 May 23, 2024
40e0c89
fix: Fix export for relation content
ArnoEgli Apr 30, 2024
2a2333e
fix: Add configureTableExporter function in definition interface
ArnoEgli May 31, 2024
e5abb8b
chore: Add composer lasserafn/php-initial-avatar-generator dependency
ArnoEgli Apr 29, 2024
8306fc0
feat: Show generated user avatar
ArnoEgli Apr 29, 2024
cce08a6
chore: removed deprecations in tests
tuxes3 Jun 10, 2024
349efb7
fix: Fix profile picture function name typo
ArnoEgli Jun 10, 2024
61afb79
feature(test): added strategy matrix for php and symfony
tuxes3 Jun 10, 2024
b4fb429
feat: move footer to the right hand side
Ruesa18 Jun 25, 2024
f1c32f0
Merge pull request #63 from araise-dev/feature/29-align-footer-right
tuxes3 Jun 27, 2024
3c1864d
fix: Fix export for relation content
ArnoEgli Jun 26, 2024
89d1f47
Merge pull request #66 from araise-dev/feature/relation-content-export
tuxes3 Jun 27, 2024
8cb9f9e
feat: align action buttons to the right without breadcrumbs
Ruesa18 Jun 25, 2024
7727b00
Merge pull request #65 from araise-dev/feature/121-buttons-right-with…
tuxes3 Jun 27, 2024
23a6b25
docs: change theme of mermaid diagrams
Ruesa18 Jun 27, 2024
16c8d31
Merge pull request #67 from araise-dev/feature/24-documentation-desig…
tuxes3 Jun 27, 2024
c77399f
feat: add exception handling for the FlashBagException from araise/co…
Ruesa18 Jun 25, 2024
f430b7f
Merge pull request #64 from araise-dev/feature/113-add-custom-flash-m…
tuxes3 Jul 1, 2024
8753a69
fix: use proper spacing for MoneyType
Ruesa18 Jul 1, 2024
f8a65c9
Merge pull request #68 from araise-dev/fix/69-moneytype-spacing
tuxes3 Jul 1, 2024
86e8453
docs: fix link to load the stylesheet
Ruesa18 Jul 2, 2024
9cbe2f2
docs: fix indentation of code
Ruesa18 Jul 2, 2024
054d40d
docs: add entry for the preselect_definition option
Ruesa18 Jul 2, 2024
259e903
Merge pull request #69 from araise-dev/feature/documentation-of-prese…
tuxes3 Jul 9, 2024
a5fa4ff
chore: updated zenstruck/foundry to ^2.0
tuxes3 Jul 9, 2024
5bba43d
feat(relation-content-export): do not configure default exporter
tuxes3 Jul 15, 2024
312b7fd
Merge pull request #71 from araise-dev/feature/export-in-relation-con…
tuxes3 Jul 15, 2024
b7c1a0b
feat: add a way to change out the main form type
Ruesa18 Jul 11, 2024
c47b237
Merge pull request #70 from araise-dev/feature/custom-main-form-type
tuxes3 Jul 15, 2024
280f359
fix(layout): add utility class to content block
marcwieland95 Jul 17, 2024
eaa67e7
fix: remove spacing between multiple error messages and add utility c…
marcwieland95 Jul 18, 2024
21385ac
fix: improve some stylings in profile section after avatar image is i…
marcwieland95 Jul 18, 2024
7351d64
fix(profile): translate strings in profile section and add alt text t…
marcwieland95 Jul 22, 2024
3fb45bf
refactor: simplify markup of profile dropdown
marcwieland95 Jul 22, 2024
5051a5e
prepare markup/init stimulus controller on form input
marcwieland95 Jul 20, 2024
12227eb
Merge pull request #74 from araise-dev/feature/improve-profile-section
marcwieland95 Jul 23, 2024
148ae06
Merge pull request #73 from araise-dev/feature/28-error-messages
marcwieland95 Jul 23, 2024
eb76321
Merge pull request #72 from araise-dev/feature/99-link-underline
marcwieland95 Jul 23, 2024
825eaa1
feat: move table header content into header section of table bundle
marcwieland95 Jul 20, 2024
4650f39
Merge pull request #75 from araise-dev/feature/119-table-header
marcwieland95 Jul 23, 2024
5a1c3ae
Merge pull request #76 from araise-dev/feature/69-input-masking
marcwieland95 Jul 23, 2024
2f0e712
fix(money-input-mask): do not set thousandsSeparator per default
tuxes3 Jul 29, 2024
8e5eea8
fix: don't make other buttons very high when one breaks into two rows
marcwieland95 Sep 19, 2024
0d547be
feat: add min/max value to pass into imask.js and allow thousandsSepa…
marcwieland95 Sep 19, 2024
059183a
Merge pull request #78 from araise-dev/feature/crud-bundle-improvements
marcwieland95 Sep 19, 2024
1c113c0
feat(relation-content): added OPT_ADD_VISIBILITY to remove add button…
tuxes3 Oct 7, 2024
f7b9407
chore: added Changelog for v1.2.0
tuxes3 Oct 8, 2024
d14088b
Merge branch 'release/v1.2.0' into develop
tuxes3 Oct 8, 2024
77829eb
feat(menu): add count to menu item
marcwieland95 Nov 27, 2024
70c57c3
Merge pull request #79 from araise-dev/feature/menu-count
tuxes3 Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 46 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: crudBundle
name: PHP Symfony CI

on:
push:
Expand All @@ -10,23 +10,55 @@ env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/crud_bundle

jobs:
phpunit:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php: [8.1, 8.2, 8.3]
symfony: [6.4.*, 7.0.*, 7.1.*]
exclude:
- php: 8.1
symfony: 7.1.*
- php: 8.1
symfony: 7.0.*

services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 3

steps:
- uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
- uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- uses: samin/mysql-action@v1.3
php-version: ${{ matrix.php }}
tools: flex
- name: Download dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
uses: ramsey/composer-install@v2
- name: Install Node.js
uses: actions/setup-node@v3
with:
mysql root password: root
- uses: actions/checkout@v2
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --prefer-dist
- name: Yarn
run: cd tests/App && yarn install && yarn dev
- name: Execute tests (Unit and Feature tests) via PHPUnit
node-version: '16'
- name: Install and build assets
run: |
cd tests/App
yarn install
yarn dev
- name: Run test suite on PHP ${{ matrix.php }} and Symfony ${{ matrix.symfony }}
run: vendor/bin/simple-phpunit
- name: Check Code Styles
- name: Run ECS
run: vendor/bin/ecs
- name: Check PHP Stan
- name: Run PHPStan
run: vendor/bin/phpstan analyse src tests
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# CHANGELOG

## v1.2.0
- Removed symfony ^5.4 support
- Improved documentation
- Introduced `DropdownAction`
- Introduced `OPT_ADD_VISIBILITY` on RelationContent to allow for more control over the visibility of the add button
- Handle `FlashBagExecption` in `CrudController`. This will allow to show flash messages on exceptions.
- Improved exporting on Relations
- Added option to change Main Form Type in the definition
- Introduced default avatar for users
- UX improvements

## v1.0.8
- More documentation and better styling of the documentation
- Added new dependency `symfony/stimulus-bundle@^2.0` and allowed `symfony/webpack-encore-bundle@^2.0`
Expand Down
41 changes: 22 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
],
"require": {
"php": ">=8.1",
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
"symfony/http-kernel": "^5.4|^6.4|^7.0",
"symfony/security-bundle": "^5.4|^6.4|^7.0",
"symfony/serializer": "^5.4|^6.4|^7.0",
"symfony/form": "^5.4|^6.4|^7.0",
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
"symfony/process": "^5.4|^6.4|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/security-bundle": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0",
"symfony/form": "^6.4|^7.0",
"symfony/twig-bundle": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/ux-turbo": "^2.0",
"symfony/stimulus-bundle": "^2.0",
"symfony/webpack-encore-bundle": "^1.14|^2.1",
Expand All @@ -34,23 +34,26 @@
"symfony/maker-bundle": "^1.0.0",
"twig/twig": "^3.4.3|^2.15.3",
"doctrine/orm": "^2.13.3|^3.1",
"doctrine/annotations": "^1.13.2|^2.0"
"doctrine/annotations": "^1.13.2|^2.0",
"lasserafn/php-initial-avatar-generator": "^4.3"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4|^6.4|^7.0",
"symfony/config": "^5.4|^6.4|^7.0",
"symfony/dependency-injection": "^5.4|^6.4|^7.0",
"symfony/yaml": "^5.4|^6.4|^7.0",
"symfony/validator": "^5.4|^6.4|^7.0",
"araise/core-bundle": "dev-develop as 1.1",
"araise/table-bundle": "dev-develop as 1.1",
"araise/search-bundle": "dev-develop as 3.1",
"symfony/phpunit-bridge": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0",
"symfony/validator": "^6.4|^7.0",
"doctrine/doctrine-bundle": "^2.5",
"whatwedo/php-coding-standard": "^1.0",
"zenstruck/foundry": "^1.16",
"zenstruck/foundry": "^2.0",
"zenstruck/console-test": "^v1.1.0",
"symfony/translation": "^5.4|^6.4|^7.0",
"gedmo/doctrine-extensions": "^3.5",
"doctrine/orm": "^2.13.3",
"symfony/dotenv": "^5.4|^6.4|^7.0",
"symfony/runtime": "^5.4|^6.4|^7.0",
"symfony/translation": "^6.4|^7.0",
"gedmo/doctrine-extensions": "^3.15",
"symfony/dotenv": "^6.4|^7.0",
"symfony/runtime": "^6.4|^7.0",
"phpstan/phpstan": "^1.5",
"mhujer/breadcrumbs-bundle": "^1.5",
"whatwedo/twig-bootstrap-icons": "^1.0"
Expand Down
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Cookbook
** [Overview](cookbook/overview.md)
** - [Login](cookbook/login.md)
** - [View Definition](cookbook/view_definition.md)
** - [Filters](cookbook/filters.md)
** - [Search](cookbook/search.md)
** - [Custom Styles](cookbook/custom_styles.md)
Expand Down
3 changes: 3 additions & 0 deletions docs/cookbook/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
- [How to remove an unwanted filter](cookbook/filters.md#how-to-remove-an-unwanted-filter)
- [How to predefine often used filters](cookbook/filters.md#how-to-predefine-often-used-filters)

- [View Definition](cookbook/view_definition.md)
- [How to prefill a relation field in forms](cookbook/view_definition.md#prefill-field-in-form)

- [Search](cookbook/search.md)
- [Prerequisites](cookbook/search.md#prerequisites)
- [Search on Definition](cookbook/search.md#search-on-definition)
Expand Down
75 changes: 75 additions & 0 deletions docs/cookbook/view_definition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# View Definition

## Prefill a relation field in forms
You can define which data row the definition uses as the default value of an input field.
This way you can either give the user advice on what you think might be right in this situation or, if you hide the input field, you can automatically fill in the correct relation for the user without him having to do anything.

As an example we use an imaginary Book/Author management software: We would like to add a button to an authors page that allows us to create a new book with the author already prefilled.
In order to achieve this, we need to add the `Content::OPT_PRESELECT_DEFINITION` and the `class` form option to the content of the `BookDefinition` like so:

```php
// BookDefinition
public function configureView(DefinitionBuilder $builder, $data): void
{
parent::configureView($builder, $data);

$builder
->addBlock('base')
->addContent('author', null, [
Content::OPT_DEFAULT_VALUE => $entity->getAuthor(),
Content::OPT_PRESELECT_DEFINITION => AuthorDefinition::class,
Content::OPT_FORM_OPTIONS => [
'class' => Author::class,
],
])
;
}
```

### Linking to the prefilled form
On the other side, in the AuthorDefinition, we can now create the link to this page like so:

```php
// AuthorDefinition
public function configureActions(mixed $data): void
{
parent::configureActions($data);

if ($data && $this->getPage() === Page::SHOW)
{
$this->addAction('add_book', [
'route' => BookDefinition::getRoute(Page::CREATE),
'route_parameters' => [
self::getQueryAlias() => $data->getId(),
],
]);
}
}
```

This adds a button on the detail page of an author that links to the create page of a book with the author preselected.

### Hiding the input field
If you want to hide the input field in the form, you can do so by using the `EntityHiddenType` as the form type like so:

```php
// BookDefinition
public function configureView(DefinitionBuilder $builder, $data): void
{
parent::configureView($builder, $data);

$builder
->addBlock('base')
->addContent('author', null, [
Content::OPT_DEFAULT_VALUE => $entity->getAuthor(),
Content::OPT_PRESELECT_DEFINITION => AuthorDefinition::class,
Content::OPT_FORM_OPTIONS => [
'class' => Author::class,
],
Content::OPT_FORM_TYPE => EntityHiddenType::class,
])
;
}
```

This way the user will not see the input field but the value will still be prefilled.
82 changes: 41 additions & 41 deletions docs/exporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,59 @@ The CrudBundle allows you to easily export your data from a Table View to CSV fi

1: Enable the export route in your definition:
```php
/**
* {@inheritdoc}
*/
public static function getCapabilities()
{
return [
Page::INDEX,
Page::SHOW,
Page::DELETE,
Page::EDIT,
Page::CREATE,
Page::EXPORT <----- Export Route
];
}
/**
* {@inheritdoc}
*/
public static function getCapabilities()
{
return [
Page::INDEX,
Page::SHOW,
Page::DELETE,
Page::EDIT,
Page::CREATE,
Page::EXPORT <----- Export Route
];
}
```

You now see an export button at the bottom of your table.

By default the table configuration will be exported.
By default, the table configuration will be exported.

## Customization

To define your custom export, just override the `configureExport` method. Create columns as you need them.

```php
public function configureExport(Table $table)
{
$this->configureTable($table);
public function configureExport(Table $table)
{
$this->configureTable($table);

$table->addColumn('id', null, [
Column::OPTION_PRIORITY => 200
])
->addColumn('jobTitle');
}
$table->addColumn('id', null, [
Column::OPTION_PRIORITY => 200
])
->addColumn('jobTitle');
}
```



## Export Column options

```php
public function configureTable(Table $table): void
{
parent::configureTable($table);
$table
->addColumn('name', null, [
Column::OPTION_EXPORT => [
Column::OPTION_EXPORT_EXPORTABLE => false
Column::OPTION_EXPORT_TEXTWRAP => true
]
])
;
}
public function configureTable(Table $table): void
{
parent::configureTable($table);
$table
->addColumn('name', null, [
Column::OPTION_EXPORT => [
Column::OPTION_EXPORT_EXPORTABLE => false
Column::OPTION_EXPORT_TEXTWRAP => true
]
])
;
}
```

## Multiple Exporter
Expand Down Expand Up @@ -96,10 +96,10 @@ class ExampleExporter implements ExporterInterface
In your definition you can add your new exporter to the table. For this override the `configureTableExporter` method and pass the acronym and the exporter:

```php
public function configureTableExporter(Table $table): void
{
parent::configureTableExporter($table);
# translation key in this example equals to -> wwd.app_entity_example.exporter.acronym_for_translation
$table->addExporter('acronym_for_translation', $this->exampleExporter);
}
public function configureTableExporter(Table $table): void
{
parent::configureTableExporter($table);
# translation key in this example equals to -> wwd.app_entity_example.exporter.acronym_for_translation
$table->addExporter('acronym_for_translation', $this->exampleExporter);
}
```
16 changes: 14 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="icon" href="media/favicon-32x32.png" sizes="32x32">
<meta name="description" content="This bundle is part of the araise.dev framework.">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@500;700&display=swap" rel="stylesheet">
Expand Down Expand Up @@ -79,7 +79,19 @@
<!-- Source: https://github.com/Leward/mermaid-docsify -->
<script type="module">
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
mermaid.initialize({ startOnLoad: true });
mermaid.initialize({
startOnLoad: true,
theme: 'base',
themeVariables: {
darkMode: true,
primaryColor: '#5b47d1',
primaryTextColor: '#ffffff',
primaryBorderColor: '#1b1447',
lineColor: '#fc00ff',
secondaryColor: '#fc00ff',
tertiaryColor: '#fc00ff',
},
});
window.mermaid = mermaid;
</script>
<script src="https://unpkg.com/docsify-mermaid@2.0.0/dist/docsify-mermaid.js"></script>
Expand Down
Loading