Skip to content

Commit

Permalink
Widgets help text / Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienheyd committed Dec 16, 2021
1 parent 2aa8e24 commit 7a08e60
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
52 changes: 29 additions & 23 deletions readme.md
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
9 changes: 6 additions & 3 deletions src/resources/views/components/file.blade.php
@@ -1,7 +1,7 @@
@if(empty($name))
<code>&lt;x-boilerplate-media-manager::file> The name attribute has not been set</code>
@else
<div class="form-group">
<div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@if(!empty($label))
{{ Form::label($name ?? 'file', $label) }}
@endif
Expand All @@ -15,9 +15,12 @@
<input type="hidden" name="{{ $name }}" value="{{ old($name, $value ?? '') }}" data-id="{{ $id }}" data-action="setMediaFile"/>
<button class="btn {{ old($name, $value ?? false) ? '' : 'd-none' }}" id="clear-{{ $id }}" type="button" data-action="clearMediaFile" style="position:absolute;right:0"><span class="fa fa-times"></span></button>
</div>
@error($name)
@if($help ?? false)
<small class="form-text text-muted">@lang($help)</small>
@endif
@error($name)
<div class="error-bubble"><div>{{ $message }}</div></div>
@enderror
@enderror
</div>
@include('boilerplate-media-manager::components.async_scripts')
@endif
7 changes: 5 additions & 2 deletions src/resources/views/components/image.blade.php
@@ -1,7 +1,7 @@
@if(empty($name))
<code>&lt;x-boilerplate-media-manager::image> The name attribute has not been set</code>
@else
<div class="form-group">
<div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@isset($label)
{!! Form::label($name, __($label)) !!}
@endisset
Expand All @@ -19,8 +19,11 @@
</div>
<input type="hidden" name="{{ $name }}" value="{{ old($name, $value ?? '') }}" data-id="{{ $id }}"/>
</div>
@if($help ?? false)
<small class="form-text text-muted">@lang($help)</small>
@endif
@error($name)
<div class="error-bubble"><div>{{ $message }}</div></div>
<div class="error-bubble"><div>{{ $message }}</div></div>
@enderror
</div>
@include('boilerplate-media-manager::components.async_scripts')
Expand Down
4 changes: 2 additions & 2 deletions tests/Components/FileTest.php
Expand Up @@ -33,7 +33,7 @@ public function testFileComponentName()
<input type="hidden" name="file" value="" data-id="test" data-action="setMediaFile"/>
<button class="btn d-none" id="clear-test" type="button" data-action="clearMediaFile" style="position:absolute;right:0"><span class="fa fa-times"></span></button>
</div>
</div>
</div>
<script>loadStylesheet("",()=>{loadScript("",()=>{window.selectMediaLocales={confirm:"Remove image ?"}})});</script>
HTML;

Expand Down Expand Up @@ -61,7 +61,7 @@ public function testFileComponentAll()
<input type="hidden" name="file" value="file.pdf" data-id="test" data-action="setMediaFile"/>
<button class="btn " id="clear-test" type="button" data-action="clearMediaFile" style="position:absolute;right:0"><span class="fa fa-times"></span></button>
</div>
</div>
</div>
<script>loadStylesheet("",()=>{loadScript("",()=>{window.selectMediaLocales={confirm:"Remove image ?"}})});</script>
HTML;

Expand Down

0 comments on commit 7a08e60

Please sign in to comment.