From 7a08e604e6f87e162143d4b3197f8f62f4edafbb Mon Sep 17 00:00:00 2001 From: Sebastien HEYD Date: Thu, 16 Dec 2021 19:57:44 +0100 Subject: [PATCH] Widgets help text / Readme --- readme.md | 52 +++++++++++-------- src/resources/views/components/file.blade.php | 9 ++-- .../views/components/image.blade.php | 7 ++- tests/Components/FileTest.php | 4 +- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/readme.md b/readme.md index 77d508d..22f13e6 100755 --- a/readme.md +++ b/readme.md @@ -40,16 +40,16 @@ php artisan storage:link After `vendor:publish`, you can find the configuration file `mediamanager.php` in the `app/config/boilerplate` folder -| configuration | description | -|---|---| -| mediamanager.base_url | Relative path to the public storage folder | -| mediamanager.tinymce_upload_dir | Directory where TinyMCE will store his edited image | -| mediamanager.thumbs_dir | Directory where to store dynamically generated thumbs | -| mediamanager.authorized.size | Upload max size in bytes, default is 2048 | -| mediamanager.authorized.mimes | Mime types by extension, see [Laravel documentation](https://laravel.com/docs/5.7/validation#rule-mimes) -| mediamanager.filetypes | Associative array to get file type by extension | -| mediamanager.icons | Associative array to get icon class (Fontawesome) by file type | -| mediamanager.filter | Array of filtered files to hide | +| configuration | description | +|---------------------------------|----------------------------------------------------------------------------------------------------------| +| mediamanager.base_url | Relative path to the public storage folder | +| mediamanager.tinymce_upload_dir | Directory where TinyMCE will store his edited image | +| mediamanager.thumbs_dir | Directory where to store dynamically generated thumbs | +| mediamanager.authorized.size | Upload max size in bytes, default is 2048 | +| mediamanager.authorized.mimes | Mime types by extension, see [Laravel documentation](https://laravel.com/docs/5.7/validation#rule-mimes) | +| mediamanager.filetypes | Associative array to get file type by extension | +| mediamanager.icons | Associative array to get icon class (Fontawesome) by file type | +| mediamanager.filter | Array of filtered files to hide | ## Backend @@ -68,13 +68,16 @@ This component allows you to use the media manager to select an image to use. Parameters are : -| name | description | default | -|--------|--------------------------|---| -| name | Input name (required) | "" | -| value | Default input value | "" | -| label | Label of the input field | "" | -| width | Width of the selector | 300 | -| height | Height of the selector | 200 | +| name | description | default | +|-------------|--------------------------------|---------| +| name | Input name (required) | "" | +| value | Default input value | "" | +| label | Label of the input field | "" | +| width | Width of the selector | 300 | +| height | Height of the selector | 200 | +| help | Help text | "" | +| group-class | Additional class to form-group | "" | +| group-id | Form-group ID | "" | ### File selector @@ -87,12 +90,15 @@ This component allows you to use the media manager to select a file to assign to Parameters are : -| name | description | default | -|---|---|--| -| name | Input name (required) | "" | -| value | Input value | "" | -| label | Label of the input field | "" | -| type | Media list filter (all, file, image, video) | all | +| name | description | default | +|-------------|---------------------------------------------|---------| +| name | Input name (required) | "" | +| value | Input value | "" | +| label | Label of the input field | "" | +| type | Media list filter (all, file, image, video) | all | +| help | Help text | "" | +| group-class | Additional class to form-group | "" | +| group-id | Form-group ID | "" | ## Frontend diff --git a/src/resources/views/components/file.blade.php b/src/resources/views/components/file.blade.php index f1a4242..643259c 100644 --- a/src/resources/views/components/file.blade.php +++ b/src/resources/views/components/file.blade.php @@ -1,7 +1,7 @@ @if(empty($name)) <x-boilerplate-media-manager::file> The name attribute has not been set @else -
+
@if(!empty($label)) {{ Form::label($name ?? 'file', $label) }} @endif @@ -15,9 +15,12 @@
- @error($name) +@if($help ?? false) + @lang($help) +@endif +@error($name)
{{ $message }}
- @enderror +@enderror
@include('boilerplate-media-manager::components.async_scripts') @endif \ No newline at end of file diff --git a/src/resources/views/components/image.blade.php b/src/resources/views/components/image.blade.php index ee1b996..b9b5419 100644 --- a/src/resources/views/components/image.blade.php +++ b/src/resources/views/components/image.blade.php @@ -1,7 +1,7 @@ @if(empty($name)) <x-boilerplate-media-manager::image> The name attribute has not been set @else -
+
@isset($label) {!! Form::label($name, __($label)) !!} @endisset @@ -19,8 +19,11 @@
+@if($help ?? false) + @lang($help) +@endif @error($name) -
{{ $message }}
+
{{ $message }}
@enderror @include('boilerplate-media-manager::components.async_scripts') diff --git a/tests/Components/FileTest.php b/tests/Components/FileTest.php index 708c867..3d5e32f 100644 --- a/tests/Components/FileTest.php +++ b/tests/Components/FileTest.php @@ -33,7 +33,7 @@ public function testFileComponentName() - + HTML; @@ -61,7 +61,7 @@ public function testFileComponentAll() - + HTML;