Skip to content

Commit

Permalink
Merge pull request #83 from digearthworks/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
inmanturbo authored Jun 5, 2021
2 parents 462a0ae + e341d8d commit c75961f
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 47 deletions.
38 changes: 38 additions & 0 deletions app/Http/Livewire/DashboardGrid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Http\Livewire;

use App\Http\Livewire\Concerns\InteractsWithDialog;
use App\Models\Menu;
use Livewire\Component;

class DashboardGrid extends Component
{
use InteractsWithDialog;

public $listeners = [
'refreshMenuGrid' => '$refresh',
'designerView' => 'designerView',
];

public $designerView = false;

public function designerView()
{
$this->designerView = ! $this->designerView;
}

public function updateSort($list)
{
if ($this->designerView) {
foreach ($list as $item) {
Menu::find($item['value'])->update(['sort' => $item['order']]);
}
}
}

public function render()
{
return view('includes.dashboard-grid');
}
}
7 changes: 7 additions & 0 deletions app/Providers/LivewireServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
use App\Http\Livewire\Admin\User\ReactivateUserDialog;
use App\Http\Livewire\Admin\User\RestoreUserDialog;
use App\Http\Livewire\Admin\User\UsersTable;
use App\Http\Livewire\DashboardGrid;
use App\Http\Livewire\Menu\MenuGrid;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;

Expand Down Expand Up @@ -63,5 +65,10 @@ public function register()
Livewire::component('admin.menus.includes.partials.create-menu-button', CreateMenuButton::class);

Livewire::component('admin.icons.icon-select', IconSelect::class);

Livewire::component('includes.dashboard-grid', DashboardGrid::class);
Livewire::component('menu.includes.menu-grid', MenuGrid::class);


}
}
32 changes: 5 additions & 27 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,10 @@
</div>

</x-slot>
<x-app-grid>
@forelse($logged_in_user->all_menus->where('name', '!=', 'Dashboard') as $item)
<x-article-stacked href="{{ $item->link }}" :target="($item->type == 'external_link') ? '_blank' : null">

<div class="w-24 h-24 ml-auto mr-auto picture-box">
{!! $item->icon->art !!}
</div>

<x-slot name="caption">
<p class="ml-auto mr-auto overflow-hidden leading-none tracking-tighter">
{{ $item->name ?? $item->link }}
</p>
</x-slot>
</x-article-stacked>
@empty
<x-article-stacked>

<svg class="h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>

<x-slot name="caption">
{{__('No Items')}}
</x-slot>
</x-article-stacked>

@endforelse
</x-app-grid>
<livewire:includes.dashboard-grid />
</x-7xl>

@if($logged_in_user->isAdmin())
<livewire:admin.menus.edit />
<livewire:admin.menus.delete />
@endif

36 changes: 36 additions & 0 deletions resources/views/includes/dashboard-grid.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div>
<x-app-grid wire:sortable="updateSort" >
@forelse($logged_in_user->all_menus->where('name', '!=', 'Dashboard')->sortBy('sort') as $item)
<x-article-stacked :href="$designerView ? 'javascript:void(0)': $item->link" wire:sortable.item="{{ $item->id }}" wire:key="item-{{ $item->uuid }}" :target="($item->type == 'external_link') ? '_blank' : null" >

<div class="w-24 h-24 ml-auto mr-auto picture-box">
{!! $item->icon->art !!}
</div>

<x-slot name="caption">
<p class="ml-auto mr-auto overflow-hidden leading-none tracking-tighter">
{{ $item->name ?? $item->link }}
</p>
</x-slot>

@if($logged_in_user->isAdmin())
<div class="flex">
<x-edit-button-live class="z-50 -ml-24 bg-opacity-90" wire:model="designerView" wire:click="dialog('edit', {{ $item->id }})" id="editMenuButton_{{ $item->id }}" />
<x-delete-button-live class="z-50 bg-opacity-90 -ml-14 " wire:model="designerView" wire:click="confirm('delete', {{ $item->id }})" />
</div>
@endif
</x-article-stacked>


@empty
<x-article-stacked>

<svg class="h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>

<x-slot name="caption">
{{__('No Items')}}
</x-slot>
</x-article-stacked>
@endforelse
</x-app-grid>
</div>
2 changes: 1 addition & 1 deletion resources/views/menus/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</x-slot>
@endif

<livewire:menu.menu-grid :menuId="$menu->id" />
<livewire:menu.includes.menu-grid :menuId="$menu->id" />
</x-7xl>
@if($logged_in_user->isAdmin())
<livewire:admin.menus.create />
Expand Down
38 changes: 19 additions & 19 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,62 @@

Route::view('/', 'welcome')->name('index');

Route::middleware(['auth', 'verified'])->get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
Route::view('/dashboard', 'dashboard')
->middleware(['auth', 'verified'])
->name('dashboard');

/*
* Admin Routes
*
* These routes can only be accessed by users with type `admin`
*/
Route::group(['prefix' => 'admin', 'as' => 'admin.', 'middleware' => 'admin'], function () {
includeRouteFiles(__DIR__.'/admin/');
includeRouteFiles(__DIR__ . '/admin/');
});

/*
* Menu Routes
*/
Route::group(['prefix' => 'menus', 'as' => 'menus.', 'middleware' => 'auth'], function () {
includeRouteFiles(__DIR__.'/menus/');
includeRouteFiles(__DIR__ . '/menus/');
});

/*
* Local Iframe Routes
*/
Route::group([
'prefix' => config('menus.url_segments.internal_iframe_prefix'),
'as' => config('menus.url_segments.internal_iframe_prefix').'.',
'as' => config('menus.url_segments.internal_iframe_prefix') . '.',
'middleware' => 'auth'
], function () {
includeRouteFiles(__DIR__.'/iframes/');
includeRouteFiles(__DIR__ . '/iframes/');
});

/*
* External Iframe Routes
*/
Route::group([
'prefix' => config('menus.url_segments.external_iframe_prefix'),
'as' => config('menus.url_segments.external_iframe_prefix').'.',
'as' => config('menus.url_segments.external_iframe_prefix') . '.',
'middleware' => 'auth'
], function () {
includeRouteFiles(__DIR__.'/extras/');
includeRouteFiles(__DIR__ . '/extras/');
});


if (config('template.cms.cms')) {
if (config('template.cms.driver') === 'wink') {
Route::middleware(config('wink.middleware_group'))
->as('wink.')
->domain(config('wink.domain'))
->prefix(config('wink.path'))
->group(function () {
Route::get('huh', function () {
->as('wink.')
->domain(config('wink.domain'))
->prefix(config('wink.path'))
->group(function () {
Route::get('huh', function () {
});
Route::get('/login', [WinkBridgeController::class, 'showLoginForm'])->name('auth.login');
Route::post('/login', [WinkBridgeController::class, 'login'])->name('auth.attempt');
// Logout Route...
Route::get('/logout', [WinkBridgeController::class, 'logout'])->name('logout');
});
Route::get('/login', [WinkBridgeController::class, 'showLoginForm'])->name('auth.login');
Route::post('/login', [WinkBridgeController::class, 'login'])->name('auth.attempt');
// Logout Route...
Route::get('/logout', [WinkBridgeController::class, 'logout'])->name('logout');
});
}
}

0 comments on commit c75961f

Please sign in to comment.