mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-28 00:24:41 -06:00
fixed upgrade errors && cat icon fixed
This commit is contained in:
parent
0e8bd9435e
commit
67b331e4f7
@ -9,10 +9,8 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if setting_value('visiosoft.module.advs::hide_price_filter') == false and not isHidden %}
|
||||
|
||||
{% if setting_value('visiosoft.module.advs::hide_price_filter') == false and not isHidden%}
|
||||
{% set hidePriceCats = setting_value('visiosoft.module.advs::hide_price_categories') %}
|
||||
{% set cats = entries('cats','category').whereIn('id', hidePriceCats).get() %}
|
||||
{% set active_currencies = setting_value('visiosoft.module.advs::enabled_currencies') %}
|
||||
|
||||
<div id="price" class="border rounded filter-box p-3 mb-3">
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
<ul class="categories-list px-0 mr-2 d-block d-sm-none">
|
||||
<li class="categories-list-li category-icon text-truncate category-{{ main_category.slug }}">
|
||||
<a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category">
|
||||
{% set icon = img(url('local://category_icon/'~main_category.id~'.png')) %}
|
||||
{% set categoryIcon = (icon.data()) ? icon.url() : img('visiosoft.theme.base::images/default-categories-icon.png').url %}
|
||||
|
||||
{% set categoryIcon = (main_category.icon) ? main_category.icon : img('visiosoft.theme.base::images/default-categories-icon.png').url %}
|
||||
<img src="{{ categoryIcon }}" alt="{{ main_category.name }}" class="img-responsive">
|
||||
<span>{{ main_category.name }}</span>
|
||||
<p class="p-0 sub-categories">
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<ul class="categories-list p-0 d-none d-sm-block">
|
||||
<li class="categories-list-li category-icon category-{{ main_category.slug }}">
|
||||
|
||||
{% set icon = img(url('local://category_icon/'~main_category.id~'.png')) %}
|
||||
{% set categoryIcon = (icon.data()) ? icon.url() : img('visiosoft.theme.base::images/default-categories-icon.png').url %}
|
||||
{% set categoryIcon = (main_category.icon) ? main_category.icon : img('visiosoft.theme.base::images/default-categories-icon.png').url %}
|
||||
|
||||
<img src="{{ categoryIcon }}" alt="{{ main_category.name }}" class="img-responsive">
|
||||
<a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category">
|
||||
|
||||
@ -5,11 +5,8 @@
|
||||
<li>
|
||||
<div class="d-flex">
|
||||
{% if (not categoryId) or (loop.first and categoryId) %}
|
||||
{# {% if maincat.icon %}#}
|
||||
{# <img src="{{ maincat.icon.url }}" alt="{{ maincat.name }}">#}
|
||||
{# {% else %}#}
|
||||
{{ img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').data|raw }}
|
||||
{# {% endif %}#}
|
||||
{% set categoryIcon = (maincat.icon) ? maincat.icon : img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').url %}
|
||||
<img src="{{ categoryIcon }}" alt="{{ main_category.name }}" class="img-responsive">
|
||||
{% endif %}
|
||||
<div class="{{ not loop.first and categoryId ? 'sub-cat' : 'ml-2' }}" style="{{ not loop.first and categoryId ? 'padding-left: ' ~ (loop.index - 1) * 0.5 ~ 'rem;' }}">
|
||||
<a href="{{ appendRequestURL(request_query(),url_route('adv_list_seo', [maincat.slug, cityId.slug]),{},['page']) }}">
|
||||
|
||||
@ -59,4 +59,9 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
|
||||
unset($categories[count($categories) - 1]);
|
||||
return $categories;
|
||||
}
|
||||
|
||||
public function setCategoryIconUrl($url)
|
||||
{
|
||||
$this->update(['icon' => $url]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
|
||||
->select(
|
||||
DB::raw('c1.id'),
|
||||
DB::raw('c1.slug'),
|
||||
DB::raw('c1.icon'),
|
||||
DB::raw('c1.count'),
|
||||
DB::raw('c1.parent_category_id'),
|
||||
DB::raw('t1.name'),
|
||||
|
||||
@ -11,4 +11,6 @@ interface CategoryInterface extends EntryInterface
|
||||
public function getParent();
|
||||
|
||||
public function getMains($id);
|
||||
|
||||
public function setCategoryIconUrl($url);
|
||||
}
|
||||
|
||||
@ -248,18 +248,28 @@ class CategoryController extends AdminController
|
||||
$folderRepository = app(FolderRepositoryInterface::class);
|
||||
$manager = app(MountManager::class);
|
||||
|
||||
if ($file = $this->request->file('icon') and $folder = $folderRepository->findBySlug('category_icon')) {
|
||||
if ($file = $this->request->file('icon') and $folder = $folderRepository->findBySlug('category_icon') and $category = $this->categoryRepository->find($category_id)) {
|
||||
|
||||
$type = explode('.', $file->getClientOriginalName());
|
||||
$type = end($type);
|
||||
|
||||
$file_location = $folder->getDisk()->getSlug() . '://' . $folder->getSlug() . '/' . FileSanitizer::clean($category_id . "." . $type);
|
||||
|
||||
$file_url = '/files/' . $folder->getSlug() . '/' . FileSanitizer::clean($category_id . "." . $type);
|
||||
|
||||
if (Storage::exists($file_location)) {
|
||||
Storage::delete($file_location);
|
||||
}
|
||||
|
||||
try {
|
||||
$manager->put($file_location, file_get_contents($file->getRealPath()));
|
||||
|
||||
$category->setCategoryIconUrl($file_url);
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
$this->messages->error([$exception->getMessage()]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user