mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #1275 from openclassify/vedat
add set main category button
This commit is contained in:
commit
d6ae6febe8
@ -5,4 +5,5 @@ return [
|
||||
'add_sub_category' => 'Add Sub Category',
|
||||
'sub_category' => 'Show Sub Category',
|
||||
'new_placeholderforsearch' => 'New Placeholderforsearch',
|
||||
'convert_main' => 'Convert Main Category',
|
||||
];
|
||||
|
||||
@ -5,4 +5,5 @@ return [
|
||||
'add_sub_category' => 'Alt Kategori Ekle',
|
||||
'sub_category' => 'Alt Kategoriyi Göster',
|
||||
'new_placeholderforsearch' => 'Arama için Yeni Yer Tutucu',
|
||||
'convert_main' => 'Ana Kategori Yap',
|
||||
];
|
||||
|
||||
@ -21,12 +21,21 @@ class CategoryTableButtons
|
||||
'type' => 'success',
|
||||
'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' => [
|
||||
'icon' => 'fa fa-trash',
|
||||
'type' => 'danger',
|
||||
'href' => function(EntryInterface $entry)
|
||||
{
|
||||
return route('visiosoft.module.cats::admin.delete_category', ['id' => $entry->getId()])."?parent=".$entry->parent_category_id;
|
||||
'href' => function (EntryInterface $entry) {
|
||||
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',
|
||||
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@import',
|
||||
],
|
||||
'admin/cats/convert-main/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@convertMain',
|
||||
'admin/cats/export' => [
|
||||
'as' => 'visiosoft.module.cats::export',
|
||||
'uses' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@export',
|
||||
|
||||
@ -273,7 +273,7 @@ class CategoryController extends AdminController
|
||||
|
||||
$file = $uploader->upload($file, $folder);
|
||||
|
||||
$url = route('anomaly.module.files::files.view',['folder' => $folder->slug,'name' => $file->name]);
|
||||
$url = route('anomaly.module.files::files.view', ['folder' => $folder->slug, 'name' => $file->name]);
|
||||
|
||||
$category->setCategoryIconUrl($url);
|
||||
} catch (\Exception $exception) {
|
||||
@ -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