From 94872f2338e6025c2f3770be256160838dae9003 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Thu, 19 Aug 2021 14:00:14 +0000 Subject: [PATCH] feat(ui): create ViewComponents library to enable building class and view files components - replace some helper components and forms with class components in the ui - create viewcomponents service and load the component function to be used in views --- app/Config/Autoload.php | 3 +- app/Helpers/components_helper.php | 31 +- app/Helpers/form_helper.php | 106 +--- app/Libraries/ViewComponents/Component.php | 36 ++ .../ViewComponents/ComponentInterface.php | 10 + .../ViewComponents/ComponentLoader.php | 86 ++++ .../ViewComponents/Config/Services.php | 30 ++ .../ViewComponents/Config/ViewComponents.php | 16 + .../Exceptions/ComponentNotFoundException.php | 12 + .../Helpers/view_components_helper.php | 28 ++ app/Resources/js/modules/xml-editor.ts | 4 + app/View/Components/Button.php | 98 ++++ app/View/Components/Forms/Input.php | 15 + app/View/Components/Forms/Label.php | 42 ++ app/View/Components/Forms/MarkdownEditor.php | 78 +++ app/View/Components/Forms/MultiSelect.php | 31 ++ app/View/Components/Forms/Select.php | 31 ++ app/View/Components/Forms/Toggler.php | 49 ++ app/View/Components/Forms/XMLEditor.php | 30 ++ app/View/Components/Icon.php | 27 + app/Views/admin/contributor/add.php | 4 +- app/Views/admin/contributor/edit.php | 2 +- app/Views/admin/episode/create.php | 194 ++++---- app/Views/admin/episode/edit.php | 462 +++++++++--------- app/Views/admin/episode/embeddable_player.php | 2 +- app/Views/admin/episode/persons.php | 44 +- app/Views/admin/episode/publish_edit.php | 36 +- app/Views/admin/page/create.php | 9 +- app/Views/admin/page/edit.php | 7 +- app/Views/admin/podcast/create.php | 92 ++-- app/Views/admin/podcast/edit.php | 325 ++++++------ app/Views/admin/podcast/persons.php | 11 +- app/Views/admin/podcast/platforms.php | 49 +- app/Views/admin/user/edit.php | 3 +- app/Views/components/.gitkeep | 0 .../comment_with_replies_authenticated.php | 2 +- app/Views/podcast/activity.php | 1 - ecs.php | 5 + phpstan.neon | 1 + rector.php | 2 +- tailwind.config.js | 1 + 41 files changed, 1323 insertions(+), 692 deletions(-) create mode 100644 app/Libraries/ViewComponents/Component.php create mode 100644 app/Libraries/ViewComponents/ComponentInterface.php create mode 100644 app/Libraries/ViewComponents/ComponentLoader.php create mode 100644 app/Libraries/ViewComponents/Config/Services.php create mode 100644 app/Libraries/ViewComponents/Config/ViewComponents.php create mode 100644 app/Libraries/ViewComponents/Exceptions/ComponentNotFoundException.php create mode 100644 app/Libraries/ViewComponents/Helpers/view_components_helper.php create mode 100644 app/View/Components/Button.php create mode 100644 app/View/Components/Forms/Input.php create mode 100644 app/View/Components/Forms/Label.php create mode 100644 app/View/Components/Forms/MarkdownEditor.php create mode 100644 app/View/Components/Forms/MultiSelect.php create mode 100644 app/View/Components/Forms/Select.php create mode 100644 app/View/Components/Forms/Toggler.php create mode 100644 app/View/Components/Forms/XMLEditor.php create mode 100644 app/View/Components/Icon.php create mode 100644 app/Views/components/.gitkeep diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index 1bc7dd61..94366380 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -46,6 +46,7 @@ class Autoload extends AutoloadConfig 'Config' => APPPATH . 'Config', 'ActivityPub' => APPPATH . 'Libraries/ActivityPub', 'Analytics' => APPPATH . 'Libraries/Analytics', + 'ViewComponents' => APPPATH . 'Libraries/ViewComponents', ]; /** @@ -84,5 +85,5 @@ class Autoload extends AutoloadConfig * ``` * @var array */ - public $files = []; + public $files = [APPPATH . 'Libraries/ViewComponents/Helpers/view_components_helper.php']; } diff --git a/app/Helpers/components_helper.php b/app/Helpers/components_helper.php index 649114ce..a15db511 100644 --- a/app/Helpers/components_helper.php +++ b/app/Helpers/components_helper.php @@ -110,7 +110,9 @@ if (! function_exists('button')) { CODE_SAMPLE; } } + // ------------------------------------------------------------------------ + if (! function_exists('icon_button')) { /** * Icon Button component @@ -145,6 +147,7 @@ if (! function_exists('icon_button')) { } } // ------------------------------------------------------------------------ + if (! function_exists('hint_tooltip')) { /** * Hint component @@ -167,7 +170,9 @@ if (! function_exists('hint_tooltip')) { return $tooltip . '">' . icon('question') . ''; } } + // ------------------------------------------------------------------------ + if (! function_exists('data_table')) { /** * Data table component @@ -223,7 +228,9 @@ if (! function_exists('data_table')) { ''; } } + // ------------------------------------------------------------------------ + if (! function_exists('publication_pill')) { /** * Publication pill component @@ -250,7 +257,9 @@ if (! function_exists('publication_pill')) { ''; } } + // ------------------------------------------------------------------------ + if (! function_exists('publication_button')) { /** * Publication button component @@ -508,27 +517,5 @@ if (! function_exists('relative_time')) { CODE_SAMPLE; } } -// ------------------------------------------------------------------------ -if (! function_exists('xml_editor')) { - /** - * XML Editor field - * - * @param array $customData - * @param array $extra - */ - function xml_editor(array $customData = [], string $value = '', array $extra = []): string - { - $defaultData = [ - 'slot' => 'textarea', - 'rows' => 5, - ]; - $data = array_merge($defaultData, $customData); - $textarea = form_textarea($data, $value, $extra); - - return <<{$textarea} - CODE_SAMPLE; - } -} // ------------------------------------------------------------------------ diff --git a/app/Helpers/form_helper.php b/app/Helpers/form_helper.php index 49eb5802..3ff660bd 100644 --- a/app/Helpers/form_helper.php +++ b/app/Helpers/form_helper.php @@ -141,38 +141,12 @@ if (! function_exists('form_label')) { //-------------------------------------------------------------------- -if (! function_exists('form_multiselect')) { - /** - * Multi-select menu - * - * @param array $options - * @param string[] $selected - * @param array $customExtra - */ - function form_multiselect( - string $name = '', - array $options = [], - array $selected = [], - array $customExtra = [] - ): string { - $defaultExtra = [ - 'data-class' => $customExtra['class'], - 'multiple' => 'multiple', - ]; - $extra = array_merge($defaultExtra, $customExtra); - - return form_dropdown($name, $options, $selected, $extra); - } -} - -//-------------------------------------------------------------------- - if (! function_exists('form_dropdown')) { /** * Drop-down Menu (based on html select tag) * * @param array $options - * @param string[] $selected + * @param array $selected * @param array $customExtra */ function form_dropdown( @@ -236,81 +210,3 @@ if (! function_exists('form_dropdown')) { return $form . "\n"; } } - -//-------------------------------------------------------------------- - -if (! function_exists('form_editor')) { - /** - * Markdown editor - * - * @param array $data - * @param array|string $extra - */ - function form_markdown_editor(array $data = [], string $value = '', string | array $extra = ''): string - { - $editorClass = 'w-full flex flex-col bg-white border border-gray-500 focus-within:ring-1 focus-within:ring-blue-600'; - if (array_key_exists('class', $data) && $data['class'] !== '') { - $editorClass .= ' ' . $data['class']; - unset($data['class']); - } - - $data['class'] = 'border-none outline-none focus:border-none focus:outline-none w-full h-full'; - - return '
' . - '
' . - '' . - '' . - '' . - '' . - '' . - '
' . - '' . icon( - 'heading' - ) . '' . - '' . icon( - 'bold' - ) . '' . - '' . icon( - 'italic' - ) . '' . - '
' . - '
' . - '' . icon( - 'list-unordered' - ) . '' . - '' . icon( - 'list-ordered' - ) . '' . - '
' . - '
' . - '' . icon( - 'quote' - ) . '' . - '' . icon( - 'link' - ) . '' . - '' . icon( - 'image-add' - ) . '' . - '
' . - '
' . - '
' . - '
' . - form_textarea($data, $value, $extra) . - '' . - '
' . - '' . - '
'; - } -} - -// ------------------------------------------------------------------------ diff --git a/app/Libraries/ViewComponents/Component.php b/app/Libraries/ViewComponents/Component.php new file mode 100644 index 00000000..57873df5 --- /dev/null +++ b/app/Libraries/ViewComponents/Component.php @@ -0,0 +1,36 @@ + + */ + protected array $attributes = [ + 'class' => '', + ]; + + /** + * @param array $properties + * @param array $attributes + */ + public function __construct( + protected array $properties, + array $attributes + ) { + // overwrite default properties if set + foreach ($properties as $key => $value) { + $this->{$key} = $value; + } + + $this->attributes = array_merge($this->attributes, $attributes); + } + + public function render(): string + { + return static::class . ': RENDER METHOD NOT IMPLEMENTED'; + } +} diff --git a/app/Libraries/ViewComponents/ComponentInterface.php b/app/Libraries/ViewComponents/ComponentInterface.php new file mode 100644 index 00000000..397bee87 --- /dev/null +++ b/app/Libraries/ViewComponents/ComponentInterface.php @@ -0,0 +1,10 @@ + + */ + protected array $properties = []; + + /** + * @var array + */ + protected array $attributes = []; + + public function __construct() + { + $this->config = config('ViewComponents'); + } + + public function __get(string $property): mixed + { + if (property_exists($this, $property)) { + return $this->{$property}; + } + } + + // @phpstan-ignore-next-line + public function __set(string $property, mixed $value) + { + if (property_exists($this, $property)) { + $this->{$property} = $value; + } + + return $this; + } + + /** + * @throws ComponentNotFoundException + */ + public function load(): string + { + // first, check if there exists a component class to load in class components path + if (file_exists("{$this->config->classComponentsPath}/{$this->name}.php")) { + return $this->loadComponentClass(); + } + + // check for the existence of a view file if no component class has been found + // component view files are camel case + $camelCaseName = strtolower(preg_replace('~(?name) ?? ''); + + if (file_exists("{$this->config->componentsViewPath}/{$camelCaseName}.php")) { + return $this->loadComponentView($camelCaseName); + } + + throw new ComponentNotFoundException("Could not find component \"{$this->name}\""); + } + + private function loadComponentClass(): string + { + $classComponentsNamespace = $this->config->classComponentsNamespace; + + $namespacedName = str_replace('/', '\\', $this->name); + $componentClassNamespace = "{$classComponentsNamespace}\\{$namespacedName}"; + + $component = new $componentClassNamespace($this->properties, $this->attributes); + return $component->render(); + } + + private function loadComponentView(string $name): string + { + $viewData = [...$this->properties, ...$this->attributes]; + + return view("components/{$name}", $viewData); + } +} diff --git a/app/Libraries/ViewComponents/Config/Services.php b/app/Libraries/ViewComponents/Config/Services.php new file mode 100644 index 00000000..1a503731 --- /dev/null +++ b/app/Libraries/ViewComponents/Config/Services.php @@ -0,0 +1,30 @@ +> $properties + * @param array> $attributes + */ + function component(string $name, array $properties = [], array $attributes = []): string + { + $componentLoader = service('viewcomponents'); + + $componentLoader->name = $name; + $componentLoader->properties = $properties; + $componentLoader->attributes = $attributes; + + return $componentLoader->load(); + } +} diff --git a/app/Resources/js/modules/xml-editor.ts b/app/Resources/js/modules/xml-editor.ts index 6f521d5b..81a8b254 100644 --- a/app/Resources/js/modules/xml-editor.ts +++ b/app/Resources/js/modules/xml-editor.ts @@ -60,6 +60,10 @@ export class XMLEditor extends LitElement { border: 1px solid #6b7280; background-color: #ffffff; } + .cm-editor.cm-focused { + outline: 2px solid transparent; + box-shadow: 0 0 0 1px #2563eb; + } `; render(): TemplateResult<1> { diff --git a/app/View/Components/Button.php b/app/View/Components/Button.php new file mode 100644 index 00000000..ac4416b2 --- /dev/null +++ b/app/View/Components/Button.php @@ -0,0 +1,98 @@ + 'text-black bg-gray-300 hover:bg-gray-400', + 'primary' => 'text-white bg-pine-700 hover:bg-pine-800', + 'secondary' => 'text-white bg-gray-700 hover:bg-gray-800', + 'accent' => 'text-white bg-rose-600 hover:bg-rose-800', + 'success' => 'text-white bg-green-600 hover:bg-green-700', + 'danger' => 'text-white bg-red-600 hover:bg-red-700', + 'warning' => 'text-black bg-yellow-500 hover:bg-yellow-600', + 'info' => 'text-white bg-blue-500 hover:bg-blue-600', + ]; + + $sizeClass = [ + 'small' => 'text-xs md:text-sm', + 'base' => 'text-sm md:text-base', + 'large' => 'text-lg md:text-xl', + ]; + + $basePaddings = [ + 'small' => 'px-2 md:px-3 md:py-1', + 'base' => 'px-3 py-1 md:px-4 md:py-2', + 'large' => 'px-3 py-2 md:px-5', + ]; + + $squaredPaddings = [ + 'small' => 'p-1', + 'base' => 'p-2', + 'large' => 'p-3', + ]; + + $buttonClass = + $baseClass . + ' ' . + ($this->isSquared + ? $squaredPaddings[$this->size] + : $basePaddings[$this->size]) . + ' ' . + $sizeClass[$this->size] . + ' ' . + $variantClass[$this->variant]; + + if (array_key_exists('class', $this->attributes)) { + $buttonClass .= ' ' . $this->attributes['class']; + unset($this->attributes['class']); + } + + if ($this->iconLeft !== '') { + $this->label = icon($this->iconLeft, 'mr-2') . $this->label; + } + + if ($this->iconRight !== '') { + $this->label .= icon($this->iconRight, 'ml-2'); + } + + if ($this->uri !== '') { + return anchor($this->uri, $this->label, array_merge([ + 'class' => $buttonClass, + ], $this->attributes)); + } + + $defaultButtonAttributes = [ + 'type' => 'button', + ]; + $attributes = stringify_attributes(array_merge($defaultButtonAttributes, $this->attributes)); + + return <<{$this->label} + CODE_SAMPLE; + } +} diff --git a/app/View/Components/Forms/Input.php b/app/View/Components/Forms/Input.php new file mode 100644 index 00000000..3dda5d57 --- /dev/null +++ b/app/View/Components/Forms/Input.php @@ -0,0 +1,15 @@ + + */ + protected array $attributes = [ + 'for' => '', + 'name' => '', + 'value' => '', + 'class' => '', + ]; + + protected string $text = ''; + + protected string $hint = ''; + + protected bool $isOptional = false; + + public function render(): string + { + $labelClass = $this->attributes['class']; + unset($this->attributes['class']); + + $attributes = stringify_attributes($this->attributes); + $optionalText = $this->isOptional ? '(' . + lang('Common.optional') . + ')' : ''; + $hint = $this->hint !== '' ? hint_tooltip($this->hint, 'ml-1') : ''; + + return <<{$this->text}{$optionalText}{$hint} + CODE_SAMPLE; + } +} diff --git a/app/View/Components/Forms/MarkdownEditor.php b/app/View/Components/Forms/MarkdownEditor.php new file mode 100644 index 00000000..48bb7165 --- /dev/null +++ b/app/View/Components/Forms/MarkdownEditor.php @@ -0,0 +1,78 @@ +attributes['class'] !== '') { + $editorClass .= ' ' . $this->attributes['class']; + unset($this->attributes['class']); + } + + $this->attributes['class'] = 'border-none outline-none focus:border-none focus:outline-none w-full h-full'; + + return '
' . + '
' . + '' . + '' . + '' . + '' . + '' . + '
' . + '' . icon( + 'heading' + ) . '' . + '' . icon( + 'bold' + ) . '' . + '' . icon( + 'italic' + ) . '' . + '
' . + '
' . + '' . icon( + 'list-unordered' + ) . '' . + '' . icon( + 'list-ordered' + ) . '' . + '
' . + '
' . + '' . icon( + 'quote' + ) . '' . + '' . icon( + 'link' + ) . '' . + '' . icon( + 'image-add' + ) . '' . + '
' . + '
' . + '
' . + '
' . + form_textarea($this->attributes, $this->content) . + '' . + '
' . + '' . + '
'; + } +} diff --git a/app/View/Components/Forms/MultiSelect.php b/app/View/Components/Forms/MultiSelect.php new file mode 100644 index 00000000..ea9374b6 --- /dev/null +++ b/app/View/Components/Forms/MultiSelect.php @@ -0,0 +1,31 @@ + + */ + protected array $options = []; + + /** + * @var string[] + */ + protected array $selected = []; + + public function render(): string + { + $defaultAttributes = [ + 'data-class' => $this->attributes['class'], + 'multiple' => 'multiple', + ]; + $extra = array_merge($defaultAttributes, $this->attributes); + + return form_dropdown($this->attributes['name'], $this->options, $this->selected, $extra); + } +} diff --git a/app/View/Components/Forms/Select.php b/app/View/Components/Forms/Select.php new file mode 100644 index 00000000..ea9374b6 --- /dev/null +++ b/app/View/Components/Forms/Select.php @@ -0,0 +1,31 @@ + + */ + protected array $options = []; + + /** + * @var string[] + */ + protected array $selected = []; + + public function render(): string + { + $defaultAttributes = [ + 'data-class' => $this->attributes['class'], + 'multiple' => 'multiple', + ]; + $extra = array_merge($defaultAttributes, $this->attributes); + + return form_dropdown($this->attributes['name'], $this->options, $this->selected, $extra); + } +} diff --git a/app/View/Components/Forms/Toggler.php b/app/View/Components/Forms/Toggler.php new file mode 100644 index 00000000..f3421bfc --- /dev/null +++ b/app/View/Components/Forms/Toggler.php @@ -0,0 +1,49 @@ + + */ + protected array $attributes = [ + 'id' => '', + 'name' => '', + 'value' => '', + 'class' => '', + ]; + + protected string $label = ''; + + protected string $hint = ''; + + protected bool $checked = false; + + public function render(): string + { + $wrapperClass = $this->attributes['class']; + unset($this->attributes['class']); + + $this->attributes['class'] = 'form-switch'; + + $checkbox = form_checkbox($this->attributes, $this->attributes['value'], $this->checked); + $hint = $this->hint !== '' ? hint_tooltip(lang('Podcast.form.lock_hint'), 'ml-1') : ''; + return << + {$checkbox} + + {$this->label}{$hint} + + CODE_SAMPLE; + } +} diff --git a/app/View/Components/Forms/XMLEditor.php b/app/View/Components/Forms/XMLEditor.php new file mode 100644 index 00000000..ef3406e4 --- /dev/null +++ b/app/View/Components/Forms/XMLEditor.php @@ -0,0 +1,30 @@ + + */ + protected array $attributes = [ + 'slot' => 'textarea', + 'rows' => '5', + 'class' => 'textarea', + ]; + + public function render(): string + { + $textarea = form_textarea($this->attributes, $this->content); + + return <<{$textarea} + CODE_SAMPLE; + } +} diff --git a/app/View/Components/Icon.php b/app/View/Components/Icon.php new file mode 100644 index 00000000..b60051af --- /dev/null +++ b/app/View/Components/Icon.php @@ -0,0 +1,27 @@ +glyph . '.svg'); + + if ($svgContents) { + if ($this->attributes['class'] !== '') { + $svgContents = str_replace(' - + lang('Contributor.form.user')], ['for' => 'user']) ?> 'user', 'class' => 'form-select mb-4', @@ -24,7 +24,7 @@ 'placeholder' => lang('Contributor.form.user_placeholder') ]) ?> - + lang('Contributor.form.role')], ['for' => 'role']) ?> 'role', 'class' => 'form-select mb-4', diff --git a/app/Views/admin/contributor/edit.php b/app/Views/admin/contributor/edit.php index a0be336a..221e9fb6 100644 --- a/app/Views/admin/contributor/edit.php +++ b/app/Views/admin/contributor/edit.php @@ -16,7 +16,7 @@ ]) ?> - + lang('Contributor.form.role')], ['for' => 'role']) ?> 'role', 'class' => 'form-select mb-4', diff --git a/app/Views/admin/episode/create.php b/app/Views/admin/episode/create.php index 738b6227..c5b885f3 100644 --- a/app/Views/admin/episode/create.php +++ b/app/Views/admin/episode/create.php @@ -28,11 +28,10 @@ lang('Episode.form.info_section_subtitle'), ) ?> - lang('Episode.form.audio_file'), 'hint' => lang('Episode.form.audio_file_hint')], + ['for' => 'audio_file'], ) ?> 'audio_file', @@ -43,12 +42,14 @@ 'accept' => '.mp3,.m4a', ]) ?> - lang('Episode.form.image'), + 'hint' => lang('Episode.form.image_hint'), + 'isOptional' => true + ], + ['for' => 'image'], ) ?> 'image', @@ -61,11 +62,11 @@ 'Common.forms.image_size_hint', ) ?> - lang('Episode.form.title'), + 'hint' => lang('Episode.form.title_hint')], + ['for' => 'title'], ) ?> 'title', @@ -76,10 +77,10 @@ 'data-slugify' => 'title', ]) ?> - lang('Episode.form.permalink')], + ['for' => 'slug'] ) ?> handle . '/episodes' ) . '/' ?> @@ -96,7 +97,7 @@
- + lang('Episode.form.season_number')], ['for' => 'season_number']) ?> 'season_number', 'name' => 'season_number', @@ -106,7 +107,7 @@ ]) ?>
- + lang('Episode.form.episode_number')], ['for' => 'episode_number']) ?> 'episode_number', 'name' => 'episode_number', @@ -203,36 +204,45 @@ ) ?>
- - lang('Episode.form.description')], ['for' => 'description']) ?> + old('description', '', false), + ], [ 'id' => 'description', 'name' => 'description', 'required' => 'required', ], - old('description', '', false), ) ?>
- lang('Episode.form.description_footer'), + 'hint' => lang('Episode.form.description_footer_hint'), + 'isOptional' => true + ], + [ + 'for' => 'description_footer' + ], ) ?> - old( + 'description_footer', + $podcast->episode_description_footer_markdown ?? '', + false, + ), + ], [ 'id' => 'description_footer', 'name' => 'description_footer', 'rows' => 6 ], - old( - 'description_footer', - $podcast->episode_description_footer_markdown ?? '', - false, - ), ) ?>
@@ -243,12 +253,13 @@ lang('Episode.form.location_section_subtitle'), ) ?> - lang('Episode.form.location_name'), + 'hint' => lang('Episode.form.location_name_hint'), + 'isOptional' => true + ], + ['for' => 'location_name'], ) ?> 'location_name', @@ -290,12 +301,12 @@
- 'sr-only'], - lang('Episode.form.transcript_file'), - true, + lang('Episode.form.transcript_file'), + 'isOptional' => true + ], + ['for' => 'transcript_file', 'class' => 'sr-only'], ) ?> 'transcript_file', @@ -306,12 +317,12 @@ ]) ?>
- 'sr-only'], - lang('Episode.form.transcript_file_remote_url'), - true, + lang('Episode.form.transcript_file_remote_url'), + 'isOptional' => true + ], + ['for' => 'transcript_file_remote_url', 'class' => 'sr-only'], ) ?> 'transcript_file_remote_url', @@ -353,12 +364,12 @@
- 'sr-only'], - lang('Episode.form.chapters_file'), - true, + lang('Episode.form.chapters_file'), + 'isOptional' => true + ], + ['for' => 'chapters_file', 'class' => 'sr-only'], ) ?> 'chapters_file', @@ -369,12 +380,15 @@ ]) ?>
- 'sr-only'], - lang('Episode.form.chapters_file_remote_url'), - true, + lang('Episode.form.chapters_file_remote_url'), + 'isOptional' => true + ], + [ + 'for' => 'chapters_file_remote_url', + 'class' => 'sr-only' + ], ) ?> 'chapters_file_remote_url', @@ -395,27 +409,37 @@ lang('Episode.form.advanced_section_title'), lang('Episode.form.advanced_section_subtitle'), ) ?> - lang('Episode.form.custom_rss'), + 'hint' => lang('Episode.form.custom_rss_hint'), + 'isOptional' => true + ], + ['for' => 'custom_rss'] +) ?> + old('custom_rss', '') + ], + [ + 'id' => 'custom_rss', + 'name' => 'custom_rss', + ] ) ?> - 'custom_rss', - 'name' => 'custom_rss', - 'class' => 'form-textarea', - 'value' => old('custom_rss'), -]) ?> - 'block', 'name' => 'block'], - 'yes', - old('block', false), + lang('Episode.form.block'), + 'hint' => lang('Episode.form.block_hint') + ], + [ + 'id' => 'block', + 'name' => 'block', + 'value' => 'yes', + 'checked' => old('block', false), + ] ) ?> ', ) ?> - + lang('Episode.form.audio_file'), 'hint' => lang('Episode.form.audio_file_hint'),], + ['for' => 'audio_file'], ) ?> 'audio_file', @@ -49,12 +49,12 @@ 'accept' => '.mp3,.m4a', ]) ?> - + lang('Episode.form.image'), 'hint' => lang('Episode.form.image_hint'), 'isOptional' => true,], + ['for' => + 'image',] ) ?> - + lang('Episode.form.title'), 'hint' => lang('Episode.form.title_hint'),], + ['for' => + 'title',] ) ?> 'title', @@ -83,27 +84,29 @@ 'data-slugify' => 'title', ]) ?> - lang('Episode.form.permalink') + ], + ['for' => 'slug',] ) ?> - handle . '/episodes' ) . '/' ?> + handle . '/episodes') . '/' ?> 'slug', - 'name' => 'slug', - 'class' => 'form-input flex-1 w-0 text-xs', - 'value' => old('slug', $episode->slug), - 'required' => 'required', - 'data-slugify' => 'slug', - 'slot' => 'slug-input' + 'id' => 'slug', + 'name' => 'slug', + 'class' => 'form-input flex-1 w-0 text-xs', + 'value' => old('slug', $episode->slug), + 'required' => 'required', + 'data-slugify' => 'slug', + 'slot' => 'slug-input' ]) ?>
- + lang('Episode.form.season_number')], ['for' => 'season_number']) ?> 'season_number', 'name' => 'season_number', @@ -113,7 +116,7 @@ ]) ?>
- + lang('Episode.form.episode_number')], ['for' => 'episode_number']) ?> 'episode_number', 'name' => 'episode_number', @@ -125,83 +128,83 @@
'flex mb-4 gap-1']) ?> - + - - 'full', 'name' => 'type', 'class' => 'form-radio-btn'], - 'full', - old('type') ? old('type') === 'full' : $episode->type === 'full', - ) ?> - - 'trailer', 'name' => 'type', 'class' => 'form-radio-btn'], - 'trailer', - old('type') ? old('type') === 'trailer' : $episode->type === 'trailer', - ) ?> - - 'bonus', 'name' => 'type', 'class' => 'form-radio-btn'], - 'bonus', - old('type') ? old('type') === 'bonus' : $episode->type === 'bonus', - ) ?> - + + 'full', 'name' => 'type', 'class' => 'form-radio-btn'], + 'full', + old('type') ? old('type') === 'full' : $episode->type === 'full', +) ?> + + 'trailer', 'name' => 'type', 'class' => 'form-radio-btn'], + 'trailer', + old('type') ? old('type') === 'trailer' : $episode->type === 'trailer', +) ?> + + 'bonus', 'name' => 'type', 'class' => 'form-radio-btn'], + 'bonus', + old('type') ? old('type') === 'bonus' : $episode->type === 'bonus', +) ?> + 'mb-6']) ?> - + - - 'undefined', - 'name' => 'parental_advisory', - 'class' => 'form-radio-btn', - ], - 'undefined', - old('parental_advisory') - ? old('parental_advisory') === 'undefined' - : $episode->parental_advisory === null, - ) ?> - - 'clean', - 'name' => 'parental_advisory', - 'class' => 'form-radio-btn', - ], - 'clean', - old('parental_advisory') - ? old('parental_advisory') === 'clean' - : $episode->parental_advisory === 'clean', - ) ?> - - 'explicit', - 'name' => 'parental_advisory', - 'class' => 'form-radio-btn', - ], - 'explicit', - old('parental_advisory') - ? old('parental_advisory') === 'explicit' - : $episode->parental_advisory === 'explicit', - ) ?> - + + 'undefined', + 'name' => 'parental_advisory', + 'class' => 'form-radio-btn', + ], + 'undefined', + old('parental_advisory') + ? old('parental_advisory') === 'undefined' + : $episode->parental_advisory === null, +) ?> + + 'clean', + 'name' => 'parental_advisory', + 'class' => 'form-radio-btn', + ], + 'clean', + old('parental_advisory') + ? old('parental_advisory') === 'clean' + : $episode->parental_advisory === 'clean', +) ?> + + 'explicit', + 'name' => 'parental_advisory', + 'class' => 'form-radio-btn', + ], + 'explicit', + old('parental_advisory') + ? old('parental_advisory') === 'explicit' + : $episode->parental_advisory === 'explicit', +) ?> + @@ -213,36 +216,43 @@ ) ?>
- - lang('Episode.form.description')], ['for' => 'description']) ?> + old('description', $episode->description_markdown, false), + ], [ 'id' => 'description', 'name' => 'description', 'required' => 'required', ], - old('description', $episode->description_markdown, false), ) ?>
- lang('Episode.form.description_footer'), + 'hint' => lang('Episode.form.description_footer_hint'), + 'isOptional' => true + ], + ['for' => 'description_footer'], ) ?> - old( + 'description_footer', + $podcast->episode_description_footer_markdown ?? '', + false, + ), + ], [ 'id' => 'description_footer', 'name' => 'description_footer', 'rows' => 6 ], - old( - 'description_footer', - $podcast->episode_description_footer_markdown ?? '', - false, - ), ) ?>
@@ -253,12 +263,13 @@ lang('Episode.form.location_section_subtitle'), ) ?> - lang('Episode.form.location_name'), + 'hint' => lang('Episode.form.location_name_hint'), + 'isOptional' => true + ], + ['for' => 'location_name'] ) ?> 'location_name', @@ -273,34 +284,34 @@ lang('Episode.form.additional_files_section_title'), lang('Episode.form.additional_files_section_subtitle', [ 'podcastNamespaceLink' => - '“podcast namespace”', + '“podcast namespace”', ]), ) ?> 'flex flex-col mb-4']) ?> - (' . - lang('Common.optional') . - ')' . - hint_tooltip(lang('Episode.form.transcript_hint'), 'ml-1') ?> -
- transcript_file_remote_url - ? '' - : 'checked' ?> /> - +(' . + lang('Common.optional') . + ')' . + hint_tooltip(lang('Episode.form.transcript_hint'), 'ml-1') ?> +
+ transcript_file_remote_url + ? '' + : 'checked' ?> /> + - transcript_file_remote_url - ? 'checked' - : '' ?> /> - + transcript_file_remote_url + ? 'checked' + : '' ?> /> + -
-
- transcript_file): ?> +
+
+ transcript_file) : ?>
transcript_file_url, @@ -321,7 +332,7 @@ icon('delete-bin', 'mx-auto'), [ 'class' => - 'p-1 bg-red-200 rounded-full text-red-700 hover:text-red-900', + 'p-1 bg-red-200 rounded-full text-red-700 hover:text-red-900', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'title' => lang( @@ -331,12 +342,12 @@ ) ?>
- 'sr-only'], - lang('Episode.form.transcript_file'), - true, + lang('Episode.form.transcript_file'), + 'isOptional' => true + ], + ['for' => 'transcript_file', 'class' => 'sr-only'], ) ?> 'transcript_file', @@ -345,14 +356,14 @@ 'type' => 'file', 'accept' => '.txt,.html,.srt,.json', ]) ?> -
-
- 'sr-only'], - lang('Episode.form.transcript_file_remote_url'), - true, +
+
+ lang('Episode.form.transcript_file_remote_url'), + 'isOptional' => true + ], + ['for' => 'transcript_file_remote_url', 'class' => 'sr-only'], ) ?> 'transcript_file_remote_url', @@ -365,35 +376,35 @@ $episode->transcript_file_remote_url, ), ]) ?> -
-
+
+
'flex flex-col mb-4']) ?> - (' . - lang('Common.optional') . - ')' . - hint_tooltip(lang('Episode.form.chapters_hint'), 'ml-1') ?> -
- chapters_file_remote_url - ? '' - : 'checked' ?> /> - +(' . + lang('Common.optional') . + ')' . + hint_tooltip(lang('Episode.form.chapters_hint'), 'ml-1') ?> +
+ chapters_file_remote_url + ? '' + : 'checked' ?> /> + - chapters_file_remote_url - ? 'checked' - : '' ?> /> - + chapters_file_remote_url + ? 'checked' + : '' ?> /> + -
-
- chapters_file): ?> +
+
+ chapters_file) : ?>
chapters_file_url, @@ -413,7 +424,7 @@ icon('delete-bin', 'mx-auto'), [ 'class' => - 'p-1 bg-red-200 rounded-full text-red-700 hover:text-red-900', + 'p-1 bg-red-200 rounded-full text-red-700 hover:text-red-900', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'title' => lang( @@ -423,12 +434,12 @@ ) ?>
- 'sr-only'], - lang('Episode.form.chapters_file'), - true, + lang('Episode.form.chapters_file'), + 'isOptional' => true + ], + ['for' => 'chapters_file', 'class' => 'sr-only'], ) ?> 'chapters_file', @@ -437,14 +448,17 @@ 'type' => 'file', 'accept' => '.json', ]) ?> -
-
- 'sr-only'], - lang('Episode.form.chapters_file_remote_url'), - true, +
+
+ lang('Episode.form.chapters_file_remote_url'), + 'isOptional' => true + ], + [ + 'for' => 'chapters_file_remote_url', + 'class' => 'sr-only' + ], ) ?> 'chapters_file_remote_url', @@ -457,9 +471,9 @@ $episode->chapters_file_remote_url, ), ]) ?> -
-
+
+
@@ -468,27 +482,39 @@ lang('Episode.form.advanced_section_title'), lang('Episode.form.advanced_section_subtitle'), ) ?> - lang('Episode.form.custom_rss'), + 'hint' => lang('Episode.form.custom_rss_hint'), + 'isOptional' => true, + ], + [ + 'for' => 'custom_rss', + ] +) ?> + old('custom_rss', $episode->custom_rss_string) + ], + [ + 'id' => 'custom_rss', + 'name' => 'custom_rss', + ] ) ?> - 'custom_rss', - 'name' => 'custom_rss', - 'class' => 'form-textarea', - 'value' => old('custom_rss', $episode->custom_rss_string), -]) ?> - 'block', 'name' => 'block'], - 'yes', - old('block', $episode->is_blocked), + lang('Episode.form.block'), + 'hint' => lang('Episode.form.block_hint') + ], + [ + 'id' => 'block', + 'name' => 'block', + 'value' => 'yes', + 'checked' => old('block', $episode->is_blocked), + ] ) ?> section('content') ?> - +

$theme): ?> diff --git a/app/Views/admin/episode/persons.php b/app/Views/admin/episode/persons.php index 293129f5..d2e1dc91 100644 --- a/app/Views/admin/episode/persons.php +++ b/app/Views/admin/episode/persons.php @@ -60,8 +60,8 @@ ($person->information_url === null ? '' : "information_url}\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"text-sm text-blue-800 hover:underline\">" . - $person->information_url . - '') . + $person->information_url . + '') . '
'; }, ], @@ -95,40 +95,36 @@ lang('Person.episode_form.add_section_subtitle'), ) ?> - lang('Person.episode_form.persons'), 'hint' => lang('Person.episode_form.persons_hint')], + ['for' => 'persons'], ) ?> - $personOptions, 'selected' => old('persons', [])], [ 'id' => 'persons', - 'class' => 'form-select mb-4', + 'name' => 'persons[]', + 'class' => 'mb-4', 'required' => 'required', ]) ?> - lang('Person.episode_form.roles'), 'hint' => lang('Person.episode_form.roles_hint'), 'isOptional' => true], + ['for' => 'roles'], ) ?> - 'roles', 'class' => 'form-select mb-4'], -) ?> - - + $taxonomyOptions, 'selected' => old('roles', [])], [ + 'id' => 'roles', + 'name' => 'roles[]', + 'class' => 'mb-4', +]) ?> + 'primary'], ['type' => 'submit', 'class' => 'self-end'], -) ?> +) ?> endSection() ?> diff --git a/app/Views/admin/episode/publish_edit.php b/app/Views/admin/episode/publish_edit.php index b83914a0..8e18531b 100644 --- a/app/Views/admin/episode/publish_edit.php +++ b/app/Views/admin/episode/publish_edit.php @@ -8,7 +8,6 @@ endSection() ?> - section('content') ?>
- <?= $podcast->actor
-                                                                        ->display_name ?> + <?= $podcast->actor->display_name ?>

- actor - ->display_name ?> - @actor->username ?> + actor->display_name ?> + @actor->username ?>

published_at, 'text-xs text-gray-500') ?>
@@ -85,17 +81,17 @@
+ 'chat', + 'text-xl mr-1 text-gray-400', + ) . '0' ?> + 'repeat', + 'text-xl mr-1 text-gray-400', + ) . '0' ?> + 'heart', + 'text-xl mr-1 text-gray-400', + ) . '0' ?>
@@ -151,10 +147,10 @@ 'data-input' => '', ]) ?> + 'Episode.publish_form.scheduled_publication_date_clear', + ) ?>" title="" data-clear="">
diff --git a/app/Views/admin/page/create.php b/app/Views/admin/page/create.php index 087b0805..711f7fdf 100644 --- a/app/Views/admin/page/create.php +++ b/app/Views/admin/page/create.php @@ -46,14 +46,17 @@
- old('content', '', false) + ], [ 'id' => 'content', 'name' => 'content', 'required' => 'required', + 'rows' => 20 ], - old('content', '', false), - ['rows' => '20'] ) ?>
diff --git a/app/Views/admin/page/edit.php b/app/Views/admin/page/edit.php index 4f74d2c3..0b2902d8 100644 --- a/app/Views/admin/page/edit.php +++ b/app/Views/admin/page/edit.php @@ -46,13 +46,16 @@
- old('content', $page->content_markdown, false), + ], [ 'id' => 'content', 'name' => 'content', 'required' => 'required', ], - old('content', $page->content_markdown, false), ) ?>
diff --git a/app/Views/admin/podcast/create.php b/app/Views/admin/podcast/create.php index 3a5a9b94..5bdbbf8a 100644 --- a/app/Views/admin/podcast/create.php +++ b/app/Views/admin/podcast/create.php @@ -82,13 +82,16 @@
- old('description', '', false), + ], [ 'id' => 'description', 'name' => 'description', 'required' => 'required', ], - old('description', '', false), ) ?>
@@ -122,16 +125,12 @@ '', true, ) ?> - 'other_categories', - 'class' => 'mb-4', - 'data-max-item-count' => '2', - ], -) ?> + $categoryOptions, 'selected' => old('other_categories', [])], [ + 'id' => 'other_categories', + 'name' => 'other_categories[]', + 'class' => 'mb-4', + 'data-max-item-count' => '2', +]) ?> 'mb-4']) ?> @@ -340,12 +339,15 @@ lang('Podcast.form.custom_rss_hint'), true, ) ?> - 'custom_rss', - 'name' => 'custom_rss', - 'class' => 'form-textarea', - 'value' => old('custom_rss'), -]) ?> + old('custom_rss', '') + ], + [ + 'id' => 'custom_rss', + 'name' => 'custom_rss', + ] +) ?> - 'block', 'name' => 'block'], - 'yes', - old('block', false), - 'mb-2', + lang('Podcast.form.lock'), + 'hint' => lang('Podcast.form.lock_hint'), + ], + [ + 'id' => 'lock', + 'name' => 'lock', + 'value' => 'yes', + 'checked' => old('complete', true), + 'class' => 'mb-2' + ] ) ?> - 'complete', 'name' => 'complete'], - 'yes', - old('complete', false), - 'mb-2', + lang('Podcast.form.block'), + ], + [ + 'id' => 'block', + 'name' => 'block', + 'value' => 'yes', + 'checked' => old('block', false), + 'class' => 'mb-2' + ] ) ?> - 'lock', 'name' => 'lock'], - 'yes', - old('lock', true), + lang('Podcast.form.complete'), + ], + [ + 'id' => 'complete', + 'name' => 'complete', + 'value' => 'yes', + 'checked' => old('complete', false), + ] ) ?> diff --git a/app/Views/admin/podcast/edit.php b/app/Views/admin/podcast/edit.php index a24413ae..8523209c 100644 --- a/app/Views/admin/podcast/edit.php +++ b/app/Views/admin/podcast/edit.php @@ -8,12 +8,14 @@ endSection() ?> + section('content') ?> id), [ 'method' => 'post', 'class' => 'flex flex-col', ]) ?> + -<?= $podcast->title ?> + +<?= $podcast->title ?> 'image', 'name' => 'image', @@ -34,11 +33,14 @@ 'type' => 'file', 'accept' => '.jpg,.jpeg,.png', ]) ?> + + + 'Common.forms.image_size_hint', + ) ?> + 'title', 'name' => 'title', @@ -46,46 +48,52 @@ 'value' => old('title', $podcast->title), 'required' => 'required', ]) ?> + link ?> 'mb-4']) ?> - - - 'episodic', 'name' => 'type', 'class' => 'form-radio-btn'], - 'episodic', - old('type') ? old('type') == 'episodic' : $podcast->type == 'episodic', - ) ?> - - 'serial', 'name' => 'type', 'class' => 'form-radio-btn'], - 'serial', - old('type') ? old('type') == 'serial' : $podcast->type == 'serial', - ) ?> - + + + + 'episodic', 'name' => 'type', 'class' => 'form-radio-btn'], + 'episodic', + old('type') ? old('type') == 'episodic' : $podcast->type == 'episodic', +) ?> + + 'serial', 'name' => 'type', 'class' => 'form-radio-btn'], + 'serial', + old('type') ? old('type') == 'serial' : $podcast->type == 'serial', +) ?> +
- old('description', $podcast->description_markdown, false) + ], + [ 'id' => 'description', 'name' => 'description', 'required' => 'required', ], - old('description', $podcast->description_markdown, false) ) ?>
- + category_id)], + [old('category', $podcast->category_id)], [ 'id' => 'category', 'class' => 'form-select mb-4', @@ -116,65 +124,63 @@ '', true, ) ?> -other_categories_ids), - [ - 'id' => 'other_categories', - 'class' => 'mb-4', - 'data-max-item-count' => '2', - ], -) ?> + + $categoryOptions, 'selected' => old('other_categories', $podcast->other_categories_ids)], [ + 'id' => 'other_categories', + 'name' => 'other_categories[]', + 'class' => 'mb-4', + 'data-max-item-count' => '2', +]) ?> 'mb-4']) ?> - - - 'undefined', - 'name' => 'parental_advisory', - 'class' => 'form-radio-btn', - ], - 'undefined', - old('parental_advisory') - ? old('parental_advisory') === 'undefined' - : $podcast->parental_advisory === null, - ) ?> - - 'clean', - 'name' => 'parental_advisory', - 'class' => 'form-radio-btn', - ], - 'clean', - old('parental_advisory') - ? old('parental_advisory') === 'clean' - : $podcast->parental_advisory === 'clean', - ) ?> - - 'explicit', - 'name' => 'parental_advisory', - 'class' => 'form-radio-btn', - ], - 'explicit', - old('parental_advisory') - ? old('parental_advisory') === 'explicit' - : $podcast->parental_advisory === 'explicit', - ) ?> - - + + 'undefined', + 'name' => 'parental_advisory', + 'class' => 'form-radio-btn', +], + 'undefined', + old('parental_advisory') + ? old('parental_advisory') === 'undefined' + : $podcast->parental_advisory === null, +) ?> + + 'clean', + 'name' => 'parental_advisory', + 'class' => 'form-radio-btn', +], + 'clean', + old('parental_advisory') + ? old('parental_advisory') === 'clean' + : $podcast->parental_advisory === 'clean', +) ?> + + + 'explicit', + 'name' => 'parental_advisory', + 'class' => 'form-radio-btn', +], + 'explicit', + old('parental_advisory') + ? old('parental_advisory') === 'explicit' + : $podcast->parental_advisory === 'explicit', +) ?> + + + + 'owner_name', 'name' => 'owner_name', @@ -202,6 +209,7 @@ [], lang('Podcast.form.owner_email_hint'), ) ?> + 'owner_email', 'name' => 'owner_email', @@ -218,6 +226,7 @@ lang('Podcast.form.publisher_hint'), true, ) ?> + 'publisher', 'name' => 'publisher', @@ -226,6 +235,7 @@ ]) ?> + 'copyright', 'name' => 'copyright', @@ -247,12 +257,14 @@ lang('Podcast.form.location_name_hint'), true, ) ?> + 'location_name', 'name' => 'location_name', 'class' => 'form-input mb-4', 'value' => old('location_name', $podcast->location_name), ]) ?> + + 'payment_pointer', 'name' => 'payment_pointer', @@ -285,41 +298,41 @@ true, ) ?> 'partner_id', - 'name' => 'partner_id', - 'class' => 'form-input w-full', - 'value' => old('partner_id', $podcast->partner_id), - ]) ?> + 'id' => 'partner_id', + 'name' => 'partner_id', + 'class' => 'form-input w-full', + 'value' => old('partner_id', $podcast->partner_id), +]) ?>
+ lang('Podcast.form.partner_link_url'), + 'partner_link_url', + [], + lang('Podcast.form.partner_link_url_hint'), + true, +) ?> 'partner_link_url', - 'name' => 'partner_link_url', - 'class' => 'form-input w-full', - 'value' => old('partner_link_url', $podcast->partner_link_url), - ]) ?> + 'id' => 'partner_link_url', + 'name' => 'partner_link_url', + 'class' => 'form-input w-full', + 'value' => old('partner_link_url', $podcast->partner_link_url), +]) ?>
- 'partner_image_url', - 'name' => 'partner_image_url', - 'class' => 'form-input w-full', - 'value' => old('partner_image_url', $podcast->partner_image_url), - ]) ?> + lang('Podcast.form.partner_image_url'), + 'partner_image_url', + [], + lang('Podcast.form.partner_image_url_hint'), + true, +) ?> + 'partner_image_url', + 'name' => 'partner_image_url', + 'class' => 'form-input w-full', + 'value' => old('partner_image_url', $podcast->partner_image_url), +]) ?>
@@ -328,6 +341,7 @@ lang('Podcast.form.advanced_section_title'), lang('Podcast.form.advanced_section_subtitle'), ) ?> + - 'custom_rss', - 'name' => 'custom_rss', - 'class' => 'form-textarea', - 'value' => old('custom_rss', $podcast->custom_rss_string), -]) ?> + + old('custom_rss', $podcast->custom_rss_string) + ], + [ + 'id' => 'custom_rss', + 'name' => 'custom_rss', + ] +) ?> + - 'block', 'name' => 'block'], - 'yes', - old('block', $podcast->is_blocked), - 'mb-2', + lang('Podcast.form.lock'), + 'hint' => lang('Podcast.form.lock_hint'), + ], + [ + 'id' => 'lock', + 'name' => 'lock', + 'value' => 'yes', + 'checked' => old('complete', $podcast->is_locked), + 'class' => 'mb-2' + ] ) ?> - 'complete', 'name' => 'complete'], - 'yes', - old('complete', $podcast->is_completed), - 'mb-2', + lang('Podcast.form.block'), + ], + [ + 'id' => 'block', + 'name' => 'block', + 'value' => 'yes', + 'checked' => old('block', $podcast->is_blocked), + 'class' => 'mb-2' + ] ) ?> - 'lock', 'name' => 'lock'], - 'yes', - old('lock', $podcast->is_locked), + lang('Podcast.form.complete'), + ], + [ + 'id' => 'complete', + 'name' => 'complete', + 'value' => 'yes', + 'checked' => old('complete', $podcast->is_completed), + ] ) ?> - 'primary'], - ['type' => 'submit', 'class' => 'self-end'], + lang('Podcast.form.submit_edit'), + 'variant' => 'primary', + ], + [ + 'type' => 'submit', + 'class' => 'self-end' + ] ) ?> - endSection() ?> diff --git a/app/Views/admin/podcast/persons.php b/app/Views/admin/podcast/persons.php index 506cedfe..f9360ec0 100644 --- a/app/Views/admin/podcast/persons.php +++ b/app/Views/admin/podcast/persons.php @@ -99,10 +99,12 @@ [], lang('Person.podcast_form.persons_hint'), ) ?> - $personOptions, 'selected' => old('persons', [])], [ 'id' => 'persons', - 'class' => 'form-select mb-4', + 'name' => 'persons[]', + 'class' => 'mb-4', 'required' => 'required', + 'data-max-item-count' => '2', ]) ?> - $taxonomyOptions, 'selected' => old('roles', [])], [ 'id' => 'roles', - 'class' => 'form-select mb-4', + 'name' => 'roles[]', + 'class' => 'mb-4', ]) ?> diff --git a/app/Views/admin/podcast/platforms.php b/app/Views/admin/podcast/platforms.php index 6cd06182..77b46d34 100644 --- a/app/Views/admin/podcast/platforms.php +++ b/app/Views/admin/podcast/platforms.php @@ -103,34 +103,39 @@ 'type' => 'text', 'placeholder' => lang("Platforms.description.{$platform->type}"), ]) ?> - lang('Platforms.visible'), + ], [ 'id' => $platform->slug . '_visible', 'name' => 'platforms[' . $platform->slug . '][visible]', - ], - 'yes', - old( - $platform->slug . '_visible', - $platform->is_visible ? $platform->is_visible : false, - ), - 'text-sm mb-1', + 'value' => 'yes', + 'checked' => old( + $platform->slug . '_visible', + $platform->is_visible ? $platform->is_visible : false, + ), + 'class' => 'text-sm mb-1' + ] ) ?> - lang('Platforms.on_embeddable_player'), + ], [ 'id' => $platform->slug . '_on_embeddable_player', - 'name' => - 'platforms[' . $platform->slug . '][on_embeddable_player]', - ], - 'yes', - old( - $platform->slug . '_on_embeddable_player', - $platform->is_on_embeddable_player - ? $platform->is_on_embeddable_player - : false, - ), - 'text-sm', + 'name' => 'platforms[' . $platform->slug . '][on_embeddable_player]', + 'value' => 'yes', + 'checked' => old( + $platform->slug . '_on_embeddable_player', + $platform->is_on_embeddable_player + ? $platform->is_on_embeddable_player + : false, + ), + 'class' => 'text-sm' + ] ) ?>
diff --git a/app/Views/admin/user/edit.php b/app/Views/admin/user/edit.php index 4fac32d9..d57f8084 100644 --- a/app/Views/admin/user/edit.php +++ b/app/Views/admin/user/edit.php @@ -17,8 +17,9 @@ -roles, [ + $roleOptions, 'selected' => $user->roles], [ 'id' => 'roles', + 'name' => 'roles[]', 'class' => 'mb-4', ]) ?> diff --git a/app/Views/components/.gitkeep b/app/Views/components/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/Views/podcast/_partials/comment_with_replies_authenticated.php b/app/Views/podcast/_partials/comment_with_replies_authenticated.php index 567137b3..52c0b4b3 100644 --- a/app/Views/podcast/_partials/comment_with_replies_authenticated.php +++ b/app/Views/podcast/_partials/comment_with_replies_authenticated.php @@ -1,4 +1,4 @@ -include('podcast/_partials/comment_card_authenticated') ?> +include('podcast/_partials/comment_card_authenticated') ?>
id, $episode->id, $comment->id), diff --git a/app/Views/podcast/activity.php b/app/Views/podcast/activity.php index 11959f91..a6d91f94 100644 --- a/app/Views/podcast/activity.php +++ b/app/Views/podcast/activity.php @@ -38,7 +38,6 @@ 'Podcast.episodes', ) ?> -
reblog_of_id !== null): ?> diff --git a/ecs.php b/ecs.php index 8a67127a..1ef585e7 100644 --- a/ecs.php +++ b/ecs.php @@ -1,6 +1,7 @@ [ + __DIR__ . '/app/Views/Components', + ] ]); $containerConfigurator->import(SetList::PSR_12); diff --git a/phpstan.neon b/phpstan.neon index 36d4a641..ac3d788d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -35,3 +35,4 @@ parameters: - app/Helpers - app/Libraries/ActivityPub/Helpers - app/Libraries/Analytics/Helpers + - app/Libraries/ViewComponents/Helpers diff --git a/rector.php b/rector.php index e3ba7ecf..f3057c66 100644 --- a/rector.php +++ b/rector.php @@ -65,7 +65,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { ], ]); - // Path to phpstan with extensions, that PHPSTan in Rector uses to determine types + // Path to phpstan with extensions, that PHPStan in Rector uses to determine types $parameters->set( Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan.neon', diff --git a/tailwind.config.js b/tailwind.config.js index 36fd2211..4b4b984e 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -4,6 +4,7 @@ module.exports = { mode: "jit", purge: [ "./app/Views/**/*.php", + "./app/View/Components/**/*.php", "./app/Helpers/*.php", "./app/Resources/**/*.ts", ],