This commit is contained in:
Kekskurse 2021-01-27 01:11:16 +01:00
parent 24df31060e
commit 76738d07e9
5 changed files with 35 additions and 1 deletions

View file

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Image; use App\Models\Image;
use App\Models\Tenant; use App\Models\Tenant;
use App\Models\Theme;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
@ -32,7 +33,8 @@ class TenantController extends BaseController
$tenant = new Tenant(); $tenant = new Tenant();
$tenant->name = $validated["name"]; $tenant->name = $validated["name"];
$tenant->url = $validated["url"]; $tenant->url = $validated["url"];
$tenant->template = "default"; $tenant->template = "kuvia-blog";
$tenant->gallery_default_theme = "kuvia-gallery";
$tenant->owner = Auth::user()->id; $tenant->owner = Auth::user()->id;
$tenant->saveOrFail(); $tenant->saveOrFail();
@ -113,4 +115,12 @@ class TenantController extends BaseController
return \redirect("/s/watermark"); return \redirect("/s/watermark");
} }
public function tenantThemeView() {
$themes = Theme::query()
->where("status", "=", "public")
->where("typ", "=", "tenant")
->get();
return view("tenant.theme", ["themes" => $themes]);
}
} }

View file

@ -38,6 +38,7 @@
<a class="dropdown-item" href="/g/{{$gallery->url}}/upload">Upload Images</a> <a class="dropdown-item" href="/g/{{$gallery->url}}/upload">Upload Images</a>
<a class="dropdown-item" href="/g/{{$gallery->url}}">Bilder</a> <a class="dropdown-item" href="/g/{{$gallery->url}}">Bilder</a>
<a class="dropdown-item" href="/g/{{$gallery->url}}/edit">Bearbeiten</a> <a class="dropdown-item" href="/g/{{$gallery->url}}/edit">Bearbeiten</a>
<a class="dropdown-item" target="_blank" href="/{{ $tenant->url }}/{{$gallery->url}}">Anschauen</a>
</div> </div>
</div> </div>
</td> </td>

View file

@ -26,6 +26,7 @@
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="/s/watermark">Watermark</a> <a class="dropdown-item" href="/s/watermark">Watermark</a>
<a class="dropdown-item" href="/s/reports">Reports</a> <a class="dropdown-item" href="/s/reports">Reports</a>
<a class="dropdown-item" href="/s/theme">Design</a>
</div> </div>
</li> </li>
</ul> </ul>

View file

@ -0,0 +1,21 @@
@extends('layout/template')
@section('content')
<h1>Themes</h1>
<table class="table table-striped">
<tr>
<th>Name</th>
<th>Vorschau</th>
<th>Action</th>
</tr>
@foreach($themes as $theme)
<tr>
<td>{{ $theme->name }}</td>
<td><a target="_blank" href="/{{ $current_tenant->url }}?theme={{ $theme->name }}">Vorschau</a></td>
<td>Auswählen</td>
</tr>
@endforeach
</table>
@endsection

View file

@ -33,6 +33,7 @@ Route::middleware([\App\Http\Middleware\TenanMiddleware::class])->group(function
Route::get("/t/new", [\App\Http\Controllers\TenantController::class, 'newView']); Route::get("/t/new", [\App\Http\Controllers\TenantController::class, 'newView']);
Route::post("/t/new", [\App\Http\Controllers\TenantController::class, 'newTenant']); Route::post("/t/new", [\App\Http\Controllers\TenantController::class, 'newTenant']);
Route::get("/t/select/{name}", [\App\Http\Controllers\TenantController::class, 'switchTenant']); Route::get("/t/select/{name}", [\App\Http\Controllers\TenantController::class, 'switchTenant']);
Route::get("/s/theme", [\App\Http\Controllers\TenantController::class, 'tenantThemeView']);
Route::get("/g", [\App\Http\Controllers\GalleryController::class, 'listView']); Route::get("/g", [\App\Http\Controllers\GalleryController::class, 'listView']);
Route::get("/g/new", [\App\Http\Controllers\GalleryController::class, 'newView']); Route::get("/g/new", [\App\Http\Controllers\GalleryController::class, 'newView']);