mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
This commit is contained in:
parent
4c66214196
commit
17509e4148
@ -7,12 +7,24 @@
|
||||
{% if table.options.sortable %}
|
||||
{{ asset_add("scripts.js", "streams::js/table/sortable.js") }}
|
||||
{% endif %}
|
||||
|
||||
{% if app.request.get('cat') != null %}
|
||||
{% set parent = category_detail(app.request.get('cat')) %}
|
||||
{% if parent.parent_category is null %}
|
||||
{% set parent_url = url('admin/cats') %}
|
||||
{% else %}
|
||||
{% set parent_url = url('admin/cats?cat='~parent.parent_category_id) %}
|
||||
{% endif %}
|
||||
<div class="container-fluid">
|
||||
<div id="buttons">
|
||||
<a class="btn btn-md btn-warning " href="{{ parent_url }}">
|
||||
<i class="fa fa-arrow-left"></i> Go To Parent ../<b><u>{{ parent.name }}</u></b>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="container-fluid">
|
||||
|
||||
{{ view("streams::table/partials/filters", {'table': table}) }}
|
||||
{{ view("streams::table/partials/views", {'table': table}) }}
|
||||
|
||||
{{ view(table.options.heading ?: "streams::table/partials/heading", {'table': table}) }}
|
||||
{% if not table.rows.empty() %}
|
||||
{% block card %}
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
<?php namespace Visiosoft\CatsModule\Category\Command;
|
||||
|
||||
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||
|
||||
class GetCategoryDetail
|
||||
{
|
||||
|
||||
/**
|
||||
* @var $id
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* GetProduct constructor.
|
||||
* @param $id
|
||||
*/
|
||||
public function __construct($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param CategoryRepositoryInterface $groups
|
||||
* @return |null
|
||||
*/
|
||||
public function handle(CategoryRepositoryInterface $groups)
|
||||
{
|
||||
if ($this->id) {
|
||||
$category = $groups->find($this->id);
|
||||
if (!is_null($category))
|
||||
return $category;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
||||
use Visiosoft\CatsModule\Category\Command\GetCategoryName;
|
||||
use Visiosoft\CatsModule\Category\Command\GetCategoryDetail;
|
||||
|
||||
class CatsModulePlugin extends Plugin
|
||||
{
|
||||
@ -20,6 +21,16 @@ class CatsModulePlugin extends Plugin
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ad;
|
||||
}
|
||||
),new \Twig_SimpleFunction(
|
||||
'category_detail',
|
||||
function ($id) {
|
||||
|
||||
if (!$ad = $this->dispatch(new GetCategoryDetail($id))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $ad;
|
||||
}
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user