Stuff
This commit is contained in:
parent
2efee483dd
commit
0fff346f15
7 changed files with 64 additions and 20 deletions
|
@ -99,6 +99,34 @@ class GalleryController extends BaseController
|
||||||
return \redirect("/g/".$gallery->url."/upload");
|
return \redirect("/g/".$gallery->url."/upload");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function editGalleryView($name, Request $request) {
|
||||||
|
$gallery = Gallery::getByTenantAndUrl(session("current_tenant_id"), $name);
|
||||||
|
session(['_old_input.name' => $gallery->name]);
|
||||||
|
session(['_old_input.description' => $gallery->description]);
|
||||||
|
session(['_old_input.date' => $gallery->gallery_create_time]);
|
||||||
|
session(['_old_input.url' => $gallery->url]);
|
||||||
|
return view("gallery.new");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editGallery($name, Request $request) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'name' => 'required|max:255',
|
||||||
|
'description' => 'max:15000000',
|
||||||
|
'url' => 'required|regex:/^[a-z0-9\-]{8,30}$/i',
|
||||||
|
'date' => 'required|regex:/^\d{4}-\d{2}-\d{2}$/i',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$gallery = Gallery::getByTenantAndUrl(session("current_tenant_id"), $name);
|
||||||
|
$gallery->name = $validated["name"];
|
||||||
|
$gallery->description = $validated["description"];
|
||||||
|
$gallery->url = $validated["url"];
|
||||||
|
$gallery->gallery_create_time = $validated["date"];
|
||||||
|
$gallery->saveOrFail();
|
||||||
|
|
||||||
|
|
||||||
|
return Redirect::back()->with(["msg" => "Saved"]);
|
||||||
|
}
|
||||||
|
|
||||||
public function imagesUploadView($name) {
|
public function imagesUploadView($name) {
|
||||||
return view("gallery.upload");
|
return view("gallery.upload");
|
||||||
}
|
}
|
||||||
|
@ -124,7 +152,6 @@ class GalleryController extends BaseController
|
||||||
$gallery->saveOrFail();
|
$gallery->saveOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class PublicController extends BaseController
|
||||||
|
|
||||||
public function listGalleriesView($name) {
|
public function listGalleriesView($name) {
|
||||||
$tenant = Tenant::query()->where("url", "=", $name)->firstOrFail();
|
$tenant = Tenant::query()->where("url", "=", $name)->firstOrFail();
|
||||||
$galleries = Gallery::query()->where("tenant", "=", $tenant->id)->get();
|
$galleries = Gallery::query()->where("tenant", "=", $tenant->id)->orderByDesc("gallery_create_time")->orderByDesc("created_at")->get();
|
||||||
return view("themes.tenant.kuvia-blog.list", ["galleries" => $galleries, "tenant" => $tenant]);
|
return view("themes.tenant.kuvia-blog.list", ["galleries" => $galleries, "tenant" => $tenant]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
@extends('layout/template')
|
@extends('layout/template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<a href="/g/new" class="btn btn-outline-success" style="float: right;">New Gallery</a>
|
<div class="row" style="margin-top: 20px;">
|
||||||
<h1>Gallery</h1>
|
<div class="col-md-12" style="margin-bottom: 10px;">
|
||||||
|
<a href="/g/new" class="btn btn-outline-success" style="float: right;">New Gallery</a>
|
||||||
|
<h1>Gallery</h1>
|
||||||
|
</div>
|
||||||
<div style="clear: both; margin-bottom: 10px;"></div>
|
<div style="clear: both; margin-bottom: 10px;"></div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
@ -34,6 +37,7 @@
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||||
<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="#">Delete</a>
|
<a class="dropdown-item" href="#">Delete</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,6 +46,7 @@
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,26 @@
|
||||||
@extends('layout/template')
|
@extends('layout/template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<h1>Gallery</h1>
|
<div class="row" style="margin-top: 20px;">
|
||||||
<div style="clear: both; margin-bottom: 10px;"></div>
|
|
||||||
@if ($errors->any())
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
<ul>
|
|
||||||
@foreach ($errors->all() as $error)
|
|
||||||
<li>{{ $error }}</li>
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
<h1>Gallery</h1>
|
||||||
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<ul>
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-9">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
@csrf
|
@csrf
|
||||||
<input name="name" value="{{ old('name') }}" placeholder="Name" class="form-control">
|
<input name="name" value="{{ old('name') }}" placeholder="Name" class="form-control">
|
||||||
<textarea name="description" value="{{ old('description') }}" placeholder="Description" class="form-control"></textarea>
|
<textarea name="description" style="height: 300px;" placeholder="Description" class="form-control">{{ old('description') }}</textarea>
|
||||||
|
|
||||||
|
|
||||||
<div class="accordion" id="accordionExample">
|
<div class="accordion" id="accordionExample">
|
||||||
|
|
||||||
|
@ -38,7 +41,14 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" class="btn btn-outline-success" value="Create" style="margin-top: 10px;">
|
<input type="submit" class="btn btn-outline-success" value="Save" style="margin-top: 10px;">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="customSwitch1" checked="">
|
||||||
|
<label class="custom-control-label" for="customSwitch1">Publish</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="collapse navbar-collapse" id="navbarColor02">
|
<div class="collapse navbar-collapse" id="navbarColor02">
|
||||||
@auth
|
@auth
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item active">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/d">Dashboard</a>
|
<a class="nav-link" href="/d">Dashboard</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@extends('layout/template')
|
@extends('layout/template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<div class="row" style="margin-top: 20px;">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
@foreach($galleries as $gallery)
|
@foreach($galleries as $gallery)
|
||||||
|
|
|
@ -40,6 +40,8 @@ Route::middleware([\App\Http\Middleware\TenanMiddleware::class])->group(function
|
||||||
Route::get("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imagesUploadView']);
|
Route::get("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imagesUploadView']);
|
||||||
Route::post("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imageUpload']);
|
Route::post("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imageUpload']);
|
||||||
Route::get("/g/{url}", [\App\Http\Controllers\GalleryController::class, 'showImagesView']);
|
Route::get("/g/{url}", [\App\Http\Controllers\GalleryController::class, 'showImagesView']);
|
||||||
|
Route::get("/g/{url}/edit", [\App\Http\Controllers\GalleryController::class, 'editGalleryView']);
|
||||||
|
Route::post("/g/{url}/edit", [\App\Http\Controllers\GalleryController::class, 'editGallery']);
|
||||||
Route::get("/g/{url}/setDefault", [\App\Http\Controllers\GalleryController::class, 'setDefault']);
|
Route::get("/g/{url}/setDefault", [\App\Http\Controllers\GalleryController::class, 'setDefault']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue