Stuff
This commit is contained in:
parent
76738d07e9
commit
210f553b49
4 changed files with 73 additions and 6 deletions
|
@ -37,14 +37,14 @@ class PublicController extends BaseController
|
|||
$gallery->html = $parser->parse($gallery->description);
|
||||
}
|
||||
|
||||
$theme = "kuvia-blog";
|
||||
$theme = $tenant->template;
|
||||
if($request->input("theme", false) && $tenant->owner == Auth::id()) {
|
||||
$theme = $request->input("theme");
|
||||
}
|
||||
return view("themes.tenant.".$theme.".list", ["galleries" => $galleries, "tenant" => $tenant]);
|
||||
}
|
||||
|
||||
public function listGalleryImagesView($tenant, $gallery) {
|
||||
public function listGalleryImagesView($tenant, $gallery, Request $request) {
|
||||
$tenant = Tenant::query()->where("url", "=", $tenant)->firstOrFail();
|
||||
$gallery = Gallery::getByTenantAndUrl($tenant->id, $gallery);
|
||||
if($gallery->status == "online" || (Auth::check() && $gallery->status == "preview" && Auth::user()->id == $tenant->owner)) {
|
||||
|
@ -61,7 +61,12 @@ class PublicController extends BaseController
|
|||
$parser = new \Parsedown();
|
||||
$gallery->html = $parser->parse($gallery->description);
|
||||
|
||||
return view("themes.gallery.kuvia-gallery.list", ["gallery" => $gallery, "tenant" => $tenant, "images" => $images]);
|
||||
$theme = $tenant->gallery_default_theme;
|
||||
if($request->input("theme", false) && $tenant->owner == Auth::id()) {
|
||||
$theme = $request->input("theme");
|
||||
}
|
||||
|
||||
return view("themes.gallery.".$theme.".list", ["gallery" => $gallery, "tenant" => $tenant, "images" => $images]);
|
||||
}
|
||||
|
||||
public function returnWatermakeFile(\App\Helper\Image $imageHelper, \App\Helper\Access $accessHelper) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Gallery;
|
||||
use App\Models\Image;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\Theme;
|
||||
|
@ -121,6 +122,46 @@ class TenantController extends BaseController
|
|||
->where("status", "=", "public")
|
||||
->where("typ", "=", "tenant")
|
||||
->get();
|
||||
return view("tenant.theme", ["themes" => $themes]);
|
||||
|
||||
$gallery_themes = Theme::query()
|
||||
->where("status", "=", "public")
|
||||
->where("typ", "=", "gallery")
|
||||
->get();
|
||||
|
||||
$gallery = Gallery::query()
|
||||
->where("tenant", "=", session("current_tenant_id"))
|
||||
->orderByDesc("id")
|
||||
->first();
|
||||
return view("tenant.theme", ["themes" => $themes, "gallery_themes" => $gallery_themes, "gallery" => $gallery]);
|
||||
}
|
||||
|
||||
public function tenantThemeSet(Request $request) {
|
||||
$tenant = Tenant::query()->where("id", "=", session("current_tenant_id"))->firstOrFail();
|
||||
$theme = Theme::query()
|
||||
->where("name", "=", $request->input("name"))
|
||||
->where("typ", "=", "tenant")
|
||||
->firstOrFail();
|
||||
if($theme->status != "public") {
|
||||
abort(400);
|
||||
}
|
||||
|
||||
$tenant->template = $theme->name;
|
||||
$tenant->saveOrFail();
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
public function tenantGalleryDefaultTemplateSet(Request $request) {
|
||||
$tenant = Tenant::query()->where("id", "=", session("current_tenant_id"))->firstOrFail();
|
||||
$theme = Theme::query()
|
||||
->where("name", "=", $request->input("name"))
|
||||
->where("typ", "=", "gallery")
|
||||
->firstOrFail();
|
||||
if($theme->status != "public") {
|
||||
abort(400);
|
||||
}
|
||||
|
||||
$tenant->gallery_default_theme = $theme->name;
|
||||
$tenant->saveOrFail();
|
||||
return Redirect::back();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@extends('layout/template')
|
||||
|
||||
@section('content')
|
||||
<h1>Themes</h1>
|
||||
<h1>Themes Tenant</h1>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
|
@ -12,7 +12,26 @@
|
|||
<tr>
|
||||
<td>{{ $theme->name }}</td>
|
||||
<td><a target="_blank" href="/{{ $current_tenant->url }}?theme={{ $theme->name }}">Vorschau</a></td>
|
||||
<td>Auswählen</td>
|
||||
<td><a href="/s/theme/set?name={{ $theme->name }}">Auswählen</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
<h1>Themes Gallery</h1>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Vorschau</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@foreach($gallery_themes as $theme)
|
||||
<tr>
|
||||
<td>{{ $theme->name }}</td>
|
||||
<td>
|
||||
@if(!is_null($gallery))
|
||||
<a target="_blank" href="/{{ $current_tenant->url }}/{{ $gallery->url }}?theme={{ $theme->name }}">Vorschau</a>
|
||||
@endif
|
||||
</td>
|
||||
<td><a href="/s/theme/set-gallery?name={{ $theme->name }}">Auswählen</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
|
|
@ -34,6 +34,8 @@ Route::middleware([\App\Http\Middleware\TenanMiddleware::class])->group(function
|
|||
Route::post("/t/new", [\App\Http\Controllers\TenantController::class, 'newTenant']);
|
||||
Route::get("/t/select/{name}", [\App\Http\Controllers\TenantController::class, 'switchTenant']);
|
||||
Route::get("/s/theme", [\App\Http\Controllers\TenantController::class, 'tenantThemeView']);
|
||||
Route::get("/s/theme/set", [\App\Http\Controllers\TenantController::class, 'tenantThemeSet']);
|
||||
Route::get("/s/theme/set-gallery", [\App\Http\Controllers\TenantController::class, 'tenantGalleryDefaultTemplateSet']);
|
||||
|
||||
Route::get("/g", [\App\Http\Controllers\GalleryController::class, 'listView']);
|
||||
Route::get("/g/new", [\App\Http\Controllers\GalleryController::class, 'newView']);
|
||||
|
|
Loading…
Reference in a new issue