Stuff
This commit is contained in:
parent
fce186a8e2
commit
46edaccf86
6 changed files with 91 additions and 3 deletions
|
@ -28,14 +28,14 @@ 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)->get();
|
||||||
return view("themes.tenant.default.list", ["galleries" => $galleries, "tenant" => $tenant]);
|
return view("themes.tenant.kuvia-gallery.list", ["galleries" => $galleries, "tenant" => $tenant]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listGalleryImagesView($tenant, $gallery) {
|
public function listGalleryImagesView($tenant, $gallery) {
|
||||||
$tenant = Tenant::query()->where("url", "=", $tenant)->firstOrFail();
|
$tenant = Tenant::query()->where("url", "=", $tenant)->firstOrFail();
|
||||||
$gallery = Gallery::getByTenantAndUrl($tenant->id, $gallery);
|
$gallery = Gallery::getByTenantAndUrl($tenant->id, $gallery);
|
||||||
$images = Image::query()->where("gallery", "=", $gallery->id)->get();
|
$images = Image::query()->where("gallery", "=", $gallery->id)->get();
|
||||||
return view("themes.gallery.default.list", ["gallery" => $gallery, "tenant" => $tenant, "images" => $images]);
|
return view("themes.gallery.kuvia-gallery.list", ["gallery" => $gallery, "tenant" => $tenant, "images" => $images]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function returnImageFile($tenant, $gallery, $image, Request $request) {
|
public function returnImageFile($tenant, $gallery, $image, Request $request) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Http\Middleware;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class TenanMiddleware
|
class TenanMiddleware
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,13 @@ class TenanMiddleware
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if(Auth::check()) {
|
if(Auth::check()) {
|
||||||
|
if(empty(session("current_tenant_id"))) {
|
||||||
|
Log::info("Set Tenant in Middleware");
|
||||||
|
$tenant = Tenant::query()->where("url", "=", Auth::user()->username)->first();
|
||||||
|
session(["current_tenant_id" => $tenant->id]);
|
||||||
|
}
|
||||||
view()->share('user_tenants', Tenant::getTenantPerUser(Auth::id()));
|
view()->share('user_tenants', Tenant::getTenantPerUser(Auth::id()));
|
||||||
|
view()->share('current_tenant', Tenant::query()->where("id", "=", session("current_tenant_id"))->first());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="/css/theme.css">
|
<link rel="stylesheet" href="/css/theme.css">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA==" crossorigin="anonymous" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
@ -20,10 +21,22 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/g">Gallery</a>
|
<a class="nav-link" href="/g">Gallery</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Settings</a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<a class="dropdown-item" href="#">Pages</a>
|
||||||
|
<a class="dropdown-item" href="#">Statistics</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item" href="/t/new">New Tenant</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@endauth
|
@endauth
|
||||||
<ul class="nav navbar-nav float-md-right">
|
<ul class="nav navbar-nav float-md-right">
|
||||||
@auth
|
@auth
|
||||||
|
<li class="nav-item active">
|
||||||
|
<a class="nav-link" href="/{{ $current_tenant->url }}"><i class="fas fa-external-link-alt"></i></a>
|
||||||
|
</li>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Tenant</a>
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Tenant</a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
|
40
resources/views/themes/gallery/kuvia-gallery/list.blade.php
Normal file
40
resources/views/themes/gallery/kuvia-gallery/list.blade.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
@extends('layout/template')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4"></div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h1>Galleries {{ $gallery->name }}</h1>
|
||||||
|
|
||||||
|
<div id="mygallery" >
|
||||||
|
<div id="fotorama" class="fotorama" data-allowfullscreen="true" data-nav="thumbs" data-width="100%">
|
||||||
|
@foreach($images as $image)
|
||||||
|
<img src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=medium" data-full="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=big" >
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('js')
|
||||||
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.css" rel="stylesheet">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.js"></script>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
// 1. Initialize fotorama manually.
|
||||||
|
var $fotoramaDiv = $('#fotorama').fotorama();
|
||||||
|
|
||||||
|
// 2. Get the API object.
|
||||||
|
var fotorama = $fotoramaDiv.data('fotorama');
|
||||||
|
|
||||||
|
// 3. Inspect it in console.
|
||||||
|
console.log(fotorama);
|
||||||
|
|
||||||
|
fotorama.requestFullScreen()
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endsection
|
|
@ -12,7 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<img class="card-img-top" src="/{{$tenant->url}}/{{$gallery->url}}/{{$gallery->main_image}}/file" style="max-height: 400px; width: auto;max-width: 100%;" alt="Card image cap">
|
<img class="card-img-top" src="/{{$tenant->url}}/{{$gallery->url}}/{{$gallery->main_image}}/file" style="max-height: 400px; width: auto;max-width: 100%;" alt="Card image cap">
|
||||||
<p class="card-text">{{ $gallery->description }}</p>
|
<p class="card-text">from {{ $gallery->gallery_create_time }}<br>{{ $gallery->description }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
28
resources/views/themes/tenant/kuvia-gallery/list.blade.php
Normal file
28
resources/views/themes/tenant/kuvia-gallery/list.blade.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
@extends('layout/template')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h1>Galleries</h1>
|
||||||
|
|
||||||
|
<div id="mygallery">
|
||||||
|
@foreach($galleries as $gallery)
|
||||||
|
<a href="/{{ $tenant->url }}/{{ $gallery->url }}/">
|
||||||
|
<img style="height: 200px;" alt="{{ $gallery->name }}" src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $gallery->main_image }}/file"/>
|
||||||
|
</a>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('js')
|
||||||
|
<link rel="stylesheet" href="/css/justifiedGallery.css" />
|
||||||
|
<script src="/js/jquery.justifiedGallery.js"></script>
|
||||||
|
<script>
|
||||||
|
$("#mygallery").justifiedGallery({
|
||||||
|
rowHeight: 250,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
Loading…
Reference in a new issue