mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
add set main category button
This commit is contained in:
parent
dd15895a1e
commit
876283462d
@ -5,4 +5,5 @@ return [
|
|||||||
'add_sub_category' => 'Add Sub Category',
|
'add_sub_category' => 'Add Sub Category',
|
||||||
'sub_category' => 'Show Sub Category',
|
'sub_category' => 'Show Sub Category',
|
||||||
'new_placeholderforsearch' => 'New Placeholderforsearch',
|
'new_placeholderforsearch' => 'New Placeholderforsearch',
|
||||||
|
'convert_main' => 'Convert Main Category',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -5,4 +5,5 @@ return [
|
|||||||
'add_sub_category' => 'Alt Kategori Ekle',
|
'add_sub_category' => 'Alt Kategori Ekle',
|
||||||
'sub_category' => 'Alt Kategoriyi Göster',
|
'sub_category' => 'Alt Kategoriyi Göster',
|
||||||
'new_placeholderforsearch' => 'Arama için Yeni Yer Tutucu',
|
'new_placeholderforsearch' => 'Arama için Yeni Yer Tutucu',
|
||||||
|
'convert_main' => 'Ana Kategori Yap',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -21,11 +21,20 @@ class CategoryTableButtons
|
|||||||
'type' => 'success',
|
'type' => 'success',
|
||||||
'href' => '/admin/cats?cat={entry.id}'
|
'href' => '/admin/cats?cat={entry.id}'
|
||||||
],
|
],
|
||||||
|
'convert_main' => [
|
||||||
|
'icon' => 'refresh',
|
||||||
|
'class' => function () {
|
||||||
|
if (!request('cat')) {
|
||||||
|
return 'hidden';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'type' => 'info',
|
||||||
|
'href' => '/admin/cats/convert-main/{entry.id}'
|
||||||
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'icon' => 'fa fa-trash',
|
'icon' => 'fa fa-trash',
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
'href' => function(EntryInterface $entry)
|
'href' => function (EntryInterface $entry) {
|
||||||
{
|
|
||||||
return route('visiosoft.module.cats::admin.delete_category', ['id' => $entry->getId()]) . "?parent=" . $entry->parent_category_id;
|
return route('visiosoft.module.cats::admin.delete_category', ['id' => $entry->getId()]) . "?parent=" . $entry->parent_category_id;
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -40,6 +40,7 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
|||||||
'as' => 'visiosoft.module.cats::import',
|
'as' => 'visiosoft.module.cats::import',
|
||||||
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@import',
|
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@import',
|
||||||
],
|
],
|
||||||
|
'admin/cats/convert-main/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@convertMain',
|
||||||
'admin/cats/export' => [
|
'admin/cats/export' => [
|
||||||
'as' => 'visiosoft.module.cats::export',
|
'as' => 'visiosoft.module.cats::export',
|
||||||
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@export',
|
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@export',
|
||||||
|
|||||||
@ -338,4 +338,14 @@ class CategoryController extends AdminController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function convertMain($id)
|
||||||
|
{
|
||||||
|
if ($category = $this->categoryRepository->find($id)) {
|
||||||
|
$category->update(['parent_category_id' => null]);
|
||||||
|
|
||||||
|
$this->messages->success(trans('streams::message.edit_success', ['name' => trans('visiosoft.module.cats::addon.title')]));
|
||||||
|
return redirect('admin/cats');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user