mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
update bindle form
This commit is contained in:
@@ -29,11 +29,14 @@ class LibraryItemForm extends Component
|
||||
|
||||
public bool $lecturer = false;
|
||||
|
||||
public bool $isBindle = false;
|
||||
|
||||
public ?string $fromUrl = '';
|
||||
|
||||
protected $queryString = [
|
||||
'fromUrl' => ['except' => ''],
|
||||
'lecturer' => ['except' => false],
|
||||
'isBindle' => ['except' => false],
|
||||
];
|
||||
|
||||
public function rules()
|
||||
@@ -57,7 +60,13 @@ class LibraryItemForm extends Component
|
||||
&& $this->libraryItem->type !== LibraryItemType::DownloadableFile(), ['url']
|
||||
),
|
||||
],
|
||||
'libraryItem.subtitle' => 'required',
|
||||
'libraryItem.subtitle' =>
|
||||
[
|
||||
Rule::when(
|
||||
$this->libraryItem->type !== 'bindle',
|
||||
'required',
|
||||
)
|
||||
],
|
||||
'libraryItem.excerpt' =>
|
||||
[
|
||||
Rule::when(
|
||||
@@ -95,7 +104,7 @@ class LibraryItemForm extends Component
|
||||
$this->libraryItem = new LibraryItem([
|
||||
'approved' => true,
|
||||
'read_time' => 1,
|
||||
'value' => '',
|
||||
'value' => ''
|
||||
]);
|
||||
if ($this->lecturer) {
|
||||
$this->library = Library::query()
|
||||
@@ -114,6 +123,13 @@ class LibraryItemForm extends Component
|
||||
if (!$this->fromUrl) {
|
||||
$this->fromUrl = url()->previous();
|
||||
}
|
||||
if ($this->isBindle) {
|
||||
$this->library = 21;
|
||||
$this->libraryItem->lecturer_id = 125;
|
||||
$this->libraryItem->type = 'bindle';
|
||||
$this->libraryItem->language_code = 'de';
|
||||
$this->selectedTags = ['Bindle'];
|
||||
}
|
||||
}
|
||||
|
||||
public function save()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="py-6">
|
||||
@if(auth()->id() == config('portal.bonus.fiat-tracker-user-id'))
|
||||
<x-button icon="plus"
|
||||
:href="route('library.libraryItem.form', ['country' => 'de'])">
|
||||
:href="route('library.libraryItem.form', ['country' => 'de', 'isBindle' => true])">
|
||||
{{ __('Neues Bindle hochladen') }}
|
||||
</x-button>
|
||||
@endif
|
||||
|
||||
@@ -133,17 +133,21 @@
|
||||
@error('image') <span class="text-red-500">{{ $message }}</span> @enderror
|
||||
</x-input.group>
|
||||
|
||||
<x-input.group :for="md5('libraryItem.main_image_caption')" :label="__('Main image caption')">
|
||||
@if(!$isBindle)
|
||||
<x-input.group :for="md5('libraryItem.main_image_caption')"
|
||||
:label="__('Main image caption')">
|
||||
<x-input autocomplete="off" wire:model.debounce="libraryItem.main_image_caption"
|
||||
:placeholder="__('Main image caption')"
|
||||
:cornerHint="__('Ex: Photo by Timothy Vollmer/ CC BY')"/>
|
||||
</x-input.group>
|
||||
@endif
|
||||
|
||||
<x-input.group :for="md5('libraryItem.name')" :label="__('Title')">
|
||||
<x-input autocomplete="off" wire:model.debounce="libraryItem.name"
|
||||
:placeholder="__('Title')"/>
|
||||
</x-input.group>
|
||||
|
||||
@if(!$isBindle)
|
||||
<x-input.group :for="md5('libraryItem.subtitle')" :label="__('Subtitle')">
|
||||
<x-input autocomplete="off" wire:model.debounce="libraryItem.subtitle"
|
||||
:placeholder="__('Subtitle')"/>
|
||||
@@ -165,6 +169,7 @@
|
||||
option-value="language"
|
||||
/>
|
||||
</x-input.group>
|
||||
@endif
|
||||
|
||||
@if($libraryItem->type === App\Enums\LibraryItemType::MarkdownArticleExtern())
|
||||
<x-input.group :for="md5('libraryItem.value')" :label="__('Article as Markdown')">
|
||||
@@ -186,10 +191,13 @@
|
||||
</x-input.group>
|
||||
@endif
|
||||
|
||||
@if(!$isBindle)
|
||||
<x-input.group :for="md5('libraryItem.read_time')" :label="__('Time to read')">
|
||||
<x-inputs.number min="1" autocomplete="off" wire:model.debounce="libraryItem.read_time"
|
||||
:placeholder="__('Time to read')" :hint="__('How many minutes to read?')"/>
|
||||
:placeholder="__('Time to read')"
|
||||
:hint="__('How many minutes to read?')"/>
|
||||
</x-input.group>
|
||||
@endif
|
||||
|
||||
<x-input.group :for="md5('meetupEvent.link')" label="">
|
||||
<x-button primary wire:click="save">
|
||||
|
||||
Reference in New Issue
Block a user