Merge pull request #984 from openclassify/muammertop

#3283 Admin Panel General Usage Needs
This commit is contained in:
Fatih Alp 2021-03-10 12:55:31 +03:00 committed by GitHub
commit 574cc532c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 36 additions and 344 deletions

View File

@ -30,11 +30,6 @@ class CatsModule extends Module
'new_category', 'new_category',
], ],
], ],
'placeholderforsearch' => [
'buttons' => [
'new_placeholderforsearch',
],
],
]; ];
} }

View File

@ -1,7 +1,6 @@
<?php namespace Visiosoft\CatsModule; <?php namespace Visiosoft\CatsModule;
use Anomaly\Streams\Platform\Database\Seeder\Seeder; use Anomaly\Streams\Platform\Database\Seeder\Seeder;
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchSeeder;
class CatsModuleSeeder extends Seeder class CatsModuleSeeder extends Seeder
{ {
@ -10,6 +9,6 @@ class CatsModuleSeeder extends Seeder
*/ */
public function run() public function run()
{ {
$this->call(PlaceholderforsearchSeeder::class); //
} }
} }

View File

@ -1,10 +1,6 @@
<?php namespace Visiosoft\CatsModule; <?php namespace Visiosoft\CatsModule;
use Anomaly\Streams\Platform\Addon\AddonServiceProvider; use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
use Visiosoft\CatsModule\Placeholderforsearch\Contract\PlaceholderforsearchRepositoryInterface;
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchRepository;
use Anomaly\Streams\Platform\Model\Cats\CatsPlaceholderforsearchEntryModel;
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchModel;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface; use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\CatsModule\Category\CategoryRepository; use Visiosoft\CatsModule\Category\CategoryRepository;
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel; use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
@ -51,9 +47,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
*/ */
protected $routes = [ protected $routes = [
'admin/cats/clean_subcats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@cleanSubcats', 'admin/cats/clean_subcats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@cleanSubcats',
'admin/cats/placeholderforsearch' => 'Visiosoft\CatsModule\Http\Controller\Admin\PlaceholderforsearchController@index',
'admin/cats/placeholderforsearch/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\PlaceholderforsearchController@create',
'admin/cats/placeholderforsearch/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\PlaceholderforsearchController@edit',
'admin/cats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@index', 'admin/cats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@index',
'admin/cats/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@create', 'admin/cats/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@create',
'admin/cats/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@edit', 'admin/cats/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@edit',
@ -117,7 +110,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
* @type array|null * @type array|null
*/ */
protected $bindings = [ protected $bindings = [
CatsPlaceholderforsearchEntryModel::class => PlaceholderforsearchModel::class,
CatsCategoryEntryModel::class => CategoryModel::class, CatsCategoryEntryModel::class => CategoryModel::class,
]; ];
@ -127,7 +119,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
* @type array|null * @type array|null
*/ */
protected $singletons = [ protected $singletons = [
PlaceholderforsearchRepositoryInterface::class => PlaceholderforsearchRepository::class,
CategoryRepositoryInterface::class => CategoryRepository::class, CategoryRepositoryInterface::class => CategoryRepository::class,
]; ];
@ -203,11 +194,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
], ],
], ],
], ],
'placeholderforsearch' => [
'buttons' => [
'new_placeholderforsearch',
],
],
]; ];
$this->addon->setSections($sections); $this->addon->setSections($sections);
} }

View File

@ -1,43 +0,0 @@
<?php namespace Visiosoft\CatsModule\Http\Controller\Admin;
use Visiosoft\CatsModule\Placeholderforsearch\Form\PlaceholderforsearchFormBuilder;
use Visiosoft\CatsModule\Placeholderforsearch\Table\PlaceholderforsearchTableBuilder;
use Anomaly\Streams\Platform\Http\Controller\AdminController;
class PlaceholderforsearchController extends AdminController
{
/**
* Display an index of existing entries.
*
* @param PlaceholderforsearchTableBuilder $table
* @return \Symfony\Component\HttpFoundation\Response
*/
public function index(PlaceholderforsearchTableBuilder $table)
{
return $table->render();
}
/**
* Create a new entry.
*
* @param PlaceholderforsearchFormBuilder $form
* @return \Symfony\Component\HttpFoundation\Response
*/
public function create(PlaceholderforsearchFormBuilder $form)
{
return $form->render();
}
/**
* Edit an existing entry.
*
* @param PlaceholderforsearchFormBuilder $form
* @param $id
* @return \Symfony\Component\HttpFoundation\Response
*/
public function edit(PlaceholderforsearchFormBuilder $form, $id)
{
return $form->render($id);
}
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Contract;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface PlaceholderforsearchInterface extends EntryInterface
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Contract;
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface PlaceholderforsearchRepositoryInterface extends EntryRepositoryInterface
{
}

View File

@ -1,66 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Form;
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
class PlaceholderforsearchFormBuilder extends FormBuilder
{
/**
* The form fields.
*
* @var array|string
*/
protected $fields = [];
/**
* Additional validation rules.
*
* @var array|string
*/
protected $rules = [];
/**
* Fields to skip.
*
* @var array|string
*/
protected $skips = [];
/**
* The form actions.
*
* @var array|string
*/
protected $actions = [];
/**
* The form buttons.
*
* @var array|string
*/
protected $buttons = [
'cancel',
];
/**
* The form options.
*
* @var array
*/
protected $options = [];
/**
* The form sections.
*
* @var array
*/
protected $sections = [];
/**
* The form assets.
*
* @var array
*/
protected $assets = [];
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryCollection;
class PlaceholderforsearchCollection extends EntryCollection
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryCriteria;
class PlaceholderforsearchCriteria extends EntryCriteria
{
}

View File

@ -1,9 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Visiosoft\CatsModule\Placeholderforsearch\Contract\PlaceholderforsearchInterface;
use Anomaly\Streams\Platform\Model\Cats\CatsPlaceholderforsearchEntryModel;
class PlaceholderforsearchModel extends CatsPlaceholderforsearchEntryModel implements PlaceholderforsearchInterface
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryObserver;
class PlaceholderforsearchObserver extends EntryObserver
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryPresenter;
class PlaceholderforsearchPresenter extends EntryPresenter
{
}

View File

@ -1,25 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Visiosoft\CatsModule\Placeholderforsearch\Contract\PlaceholderforsearchRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
class PlaceholderforsearchRepository extends EntryRepository implements PlaceholderforsearchRepositoryInterface
{
/**
* The entry model.
*
* @var PlaceholderforsearchModel
*/
protected $model;
/**
* Create a new PlaceholderforsearchRepository instance.
*
* @param PlaceholderforsearchModel $model
*/
public function __construct(PlaceholderforsearchModel $model)
{
$this->model = $model;
}
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryRouter;
class PlaceholderforsearchRouter extends EntryRouter
{
}

View File

@ -1,49 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
use Illuminate\Support\Facades\DB;
class PlaceholderforsearchSeeder extends Seeder
{
/**
* Run the seeder.
*/
public function run()
{
DB::table('cats_placeholderforsearch')->truncate();
DB::table('cats_placeholderforsearch_translations')->truncate();
PlaceholderforsearchModel::create([
'en' => [
'name' => 'Chevrolet Camaro'
],
'tr' => [
'name' => 'Chevrolet Camaro'
]
]);
PlaceholderforsearchModel::create([
'en' => [
'name' => 'Xiaomi Black Shark 128 GB'
],
'tr' => [
'name' => 'Xiaomi Black Shark 128 GB'
]
]);
PlaceholderforsearchModel::create([
'en' => [
'name' => 'Apple MacBook Pro'
],
'tr' => [
'name' => 'Apple MacBook Pro'
]
]);
PlaceholderforsearchModel::create([
'en' => [
'name' => 'Make your search now'
],
'tr' => [
'name' => 'Make your search now'
]
]);
}
}

View File

@ -1,61 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Table;
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
class PlaceholderforsearchTableBuilder extends TableBuilder
{
/**
* The table views.
*
* @var array|string
*/
protected $views = [];
/**
* The table filters.
*
* @var array|string
*/
protected $filters = [];
/**
* The table columns.
*
* @var array|string
*/
protected $columns = [];
/**
* The table buttons.
*
* @var array|string
*/
protected $buttons = [
'edit'
];
/**
* The table actions.
*
* @var array|string
*/
protected $actions = [
'delete'
];
/**
* The table options.
*
* @var array
*/
protected $options = [];
/**
* The table assets.
*
* @var array
*/
protected $assets = [];
}

View File

@ -62,7 +62,7 @@
} }
} }
img { svg {
margin-right: .75rem; margin-right: .75rem;
width: 1.5rem; width: 1.5rem;
height: 1.5rem; height: 1.5rem;

View File

@ -2,7 +2,7 @@
{{ asset_style("visiosoft.module.profile::assets/css/profile-nav.scss") }} {{ asset_style("visiosoft.module.profile::assets/css/profile-nav.scss") }}
{% endblock %} {% endblock %}
<div class="row mt-md-5"> <div class="row my-md-5">
{% include "visiosoft.module.profile::profile/partials/navigation" %} {% include "visiosoft.module.profile::profile/partials/navigation" %}

View File

@ -4,26 +4,26 @@
</div> </div>
<div class="col-10 col-sm-6 col-md-3 profile-navigation border rounded navbar-side bg-white" id="navbarSide"> <div class="col-10 col-sm-6 col-md-3 profile-navigation border rounded navbar-side bg-white" id="navbarSide">
<a href="{{ url_route('profile::profile') }}" class="px-3 mb-2 link-unstyled"> <a href="{{ url_route('profile::profile') }}" class="px-3 mb-2 link-unstyled">
<img src="{{ img('visiosoft.module.profile::images/interface.svg').url }}"> {{ img('visiosoft.module.profile::images/interface.svg').data|raw }}
<p>{{ auth_user().name }}</p> <p>{{ auth_user().name }}</p>
</a> </a>
<hr class="mt-2"> <hr class="mt-2">
<a href="{{ url_route('profile::profile') }}" <a href="{{ url_route('profile::profile') }}"
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile' ? ' active' : '' }}"> class="px-3 link-unstyled{{ app.request.pathinfo == '/profile' ? ' active' : '' }}">
<img src="{{ img('visiosoft.module.profile::images/social-media.svg').url }}"> {{ img('visiosoft.module.profile::images/social-media.svg').data|raw }}
<p>{{ trans('visiosoft.module.profile::addon.title') }}</p> <p>{{ trans('visiosoft.module.profile::addon.title') }}</p>
</a> </a>
{% set marketPlace = setting_value('visiosoft.module.advs::market_place') %} {% set marketPlace = setting_value('visiosoft.module.advs::market_place') %}
{% if marketPlace %} {% if marketPlace %}
<a href="{{ url_route('profile::ads') }}" <a href="{{ url_route('profile::ads') }}"
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile/ads' ? ' active' : '' }}"> class="px-3 link-unstyled{{ app.request.pathinfo == '/profile/ads' ? ' active' : '' }}">
<img src="{{ img('visiosoft.module.profile::images/website.svg').url }}"> {{ img('visiosoft.module.profile::images/website.svg').data|raw }}
<p>{{ trans('visiosoft.module.advs::addon.title') }}</p> <p>{{ trans('visiosoft.module.advs::addon.title') }}</p>
</a> </a>
{% endif %} {% endif %}
<a href="{{ url_route('profile::address') }}" <a href="{{ url_route('profile::address') }}"
class="px-3 link-unstyled{{ app.request.pathinfo == '/profile/address' ? ' active' : '' }}"> class="px-3 link-unstyled{{ app.request.pathinfo == '/profile/address' ? ' active' : '' }}">
<img src="{{ img('visiosoft.module.profile::images/location.svg').url }}"> {{ img('visiosoft.module.profile::images/location.svg').data|raw }}
<p>{{ trans('visiosoft.module.profile::stream.adress.name') }}</p> <p>{{ trans('visiosoft.module.profile::stream.adress.name') }}</p>
</a> </a>
@ -31,7 +31,7 @@
<a href="{{ url('logout') }}" <a href="{{ url('logout') }}"
class="px-3 link-unstyled d-flex d-md-none"> class="px-3 link-unstyled d-flex d-md-none">
<img src="{{ img('visiosoft.module.profile::images/logout.svg').url }}"> {{ img('visiosoft.module.profile::images/logout.svg').data|raw }}
<p>{{ trans('visiosoft.theme.base::field.logout.name') }}</p> <p>{{ trans('visiosoft.theme.base::field.logout.name') }}</p>
</a> </a>
</div> </div>

View File

@ -2,6 +2,8 @@
namespace App\Providers; namespace App\Providers;
use Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\NavigationFactory;
use Anomaly\Streams\Platform\Ui\ControlPanel\ControlPanelBuilder;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
@ -12,15 +14,34 @@ class AppServiceProvider extends ServiceProvider
* *
* @return void * @return void
*/ */
public function boot() public function boot(ControlPanelBuilder $builder, NavigationFactory $factory)
{ {
view()->composer('*', function ($view) { view()->composer('*', function ($view) use ($builder, $factory) {
//Hidden menu items in sidebar on dashboard
if (auth()->check() and template()->get('cp')) { if (auth()->check() and template()->get('cp')) {
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.variables')) ? $navigation->setClass('hidden') : false; //Hidden menu items in sidebar on dashboard
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.system')) ? $navigation->setClass('hidden') : false; ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.variables')) ? $navigation->setClass('hidden') : false;
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.redirects')) ? $navigation->setClass('hidden') : false; ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.system')) ? $navigation->setClass('hidden') : false;
$is_hidden = ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.repeaters')) ? $navigation->setClass('hidden') : false; ($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.redirects')) ? $navigation->setClass('hidden') : false;
($navigation = template()->get('cp')->getNavigation()->get('anomaly.module.repeaters')) ? $navigation->setClass('hidden') : false;
// Add new menu items in sidebar on dashboard
$newNavigations = [
[
'slug' => setting_value("streams::standard_theme"),
'icon' => 'fa fa-pencil-square-o',
'title' => 'visiosoft.theme.defaultadmin::section.theme_settings.name',
'attributes' => [
'href' => url("admin/settings/themes/" . setting_value("streams::standard_theme"))
]
]
];
$cp = $builder->getControlPanel();
foreach ($newNavigations as $newNavigation) {
if (!template()->get('cp')->getNavigation()->get($newNavigation['slug'])){
$cp->addNavigationLink($factory->make($newNavigation));
}
}
} }
//Auto Language Switcher //Auto Language Switcher
if (config('advs.lang_switcher_for_browser') and is_null(Request()->session()->get('_locale')) and isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { if (config('advs.lang_switcher_for_browser') and is_null(Request()->session()->get('_locale')) and isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {