finish searchbox build + upload/edit form quality render

This commit is contained in:
xiaomlove
2022-09-14 19:05:29 +08:00
parent a7717b2ce8
commit c9c16bc5bd
22 changed files with 313 additions and 79 deletions
@@ -45,7 +45,6 @@ class SectionResource extends Resource
{
return $form
->schema([
Forms\Components\TextInput::make('section_name')->label(__('label.search_box.section_name'))->required(),
Forms\Components\TextInput::make('name')->label(__('label.search_box.name'))->rules('alpha_dash')->required(),
Forms\Components\TextInput::make('catsperrow')
->label(__('label.search_box.catsperrow'))
@@ -61,6 +60,10 @@ class SectionResource extends Resource
->required()
->default(3)
,
Forms\Components\TextInput::make('section_name')
->label(__('label.search_box.section_name'))
->helperText(__('label.search_box.section_name_help'))
,
Forms\Components\CheckboxList::make('custom_fields')
->options(TorrentCustomField::getCheckboxOptions())
->label(__('label.search_box.custom_fields'))
@@ -109,8 +112,8 @@ class SectionResource extends Resource
return $table
->columns([
Tables\Columns\TextColumn::make('id'),
Tables\Columns\TextColumn::make('section_name')->label(__('label.search_box.section_name')),
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.name')),
Tables\Columns\TextColumn::make('section_name')->label(__('label.search_box.section_name')),
Tables\Columns\BooleanColumn::make('is_default')->label(__('label.search_box.is_default')),
Tables\Columns\BooleanColumn::make('showsubcat')->label(__('label.search_box.showsubcat')),
Tables\Columns\BooleanColumn::make('showsource'),
@@ -23,4 +23,9 @@ class EditSection extends EditRecord
return SearchBox::formatTaxonomyExtra($data);
}
protected function afterSave()
{
clear_search_box_cache($this->record->id);
}
}
@@ -26,15 +26,16 @@ class CategoriesRelationManager extends RelationManager
{
return $form
->schema([
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name')),
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
Forms\Components\TextInput::make('image')
->rule('alpha_dash')
->label(__('label.search_box.taxonomy.image'))
->helperText(__('label.search_box.taxonomy.image_help'))
->required()
,
Forms\Components\Select::make('icon_id')
->options(Icon::query()->pluck('name', 'id')->toArray())
->label(__('label.search_box.taxonomy.icon_id'))
->required()
,
Forms\Components\TextInput::make('class_name')
->label(__('label.search_box.taxonomy.class_name'))
@@ -57,19 +58,27 @@ class CategoriesRelationManager extends RelationManager
Tables\Columns\TextColumn::make('icon.name')->label(__('label.search_box.taxonomy.icon_id')),
Tables\Columns\TextColumn::make('image')->label(__('label.search_box.taxonomy.image')),
Tables\Columns\TextColumn::make('class_name')->label(__('label.search_box.taxonomy.class_name')),
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
])
->defaultSort('sort_index')
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
Tables\Actions\CreateAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
Tables\Actions\EditAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
Tables\Actions\DeleteAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
}
@@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyAudioCodecsRelationManager extends TaxonomySourcesRelationManager
{
protected static string $relationship = 'taxonomy_audio_codecs';
protected static string $relationship = 'taxonomy_audiocodec';
protected static ?string $recordTitleAttribute = 'name';
@@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyCodecsRelationManager extends TaxonomySourcesRelationManager
{
protected static string $relationship = 'taxonomy_codecs';
protected static string $relationship = 'taxonomy_codec';
protected static ?string $recordTitleAttribute = 'name';
@@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomySourcesRelationManager extends RelationManager
{
protected static string $relationship = 'taxonomy_sources';
protected static string $relationship = 'taxonomy_source';
protected static ?string $recordTitleAttribute = 'name';
@@ -94,14 +94,20 @@ class TaxonomySourcesRelationManager extends RelationManager
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
Tables\Actions\CreateAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
Tables\Actions\EditAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
Tables\Actions\DeleteAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyStandardsRelationManager extends TaxonomySourcesRelationManager
{
protected static string $relationship = 'taxonomy_standards';
protected static string $relationship = 'taxonomy_standard';
protected static ?string $recordTitleAttribute = 'name';
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyTeamsRelationManager extends TaxonomySourcesRelationManager
{
protected static string $relationship = 'taxonomy_teams';
protected static string $relationship = 'taxonomy_team';
protected static ?string $recordTitleAttribute = 'name';