admin views

This commit is contained in:
Dym Sohin 2024-08-07 15:33:25 +02:00
parent 79d9d8df71
commit 6251eb3281
17 changed files with 240 additions and 31 deletions

6
.env
View File

@ -22,9 +22,9 @@ LOG_LEVEL=debug
DB_CONNECTION=pgsql DB_CONNECTION=pgsql
DB_HOST=127.0.0.1 DB_HOST=127.0.0.1
DB_PORT=5432 DB_PORT=5432
DB_DATABASE=laravel DB_DATABASE=dym
DB_USERNAME=laravel DB_USERNAME=dym
DB_PASSWORD=laravel DB_PASSWORD=+-Vl+'&Qfb[2LxbhpR].S6F<MC}>xk(Y+qQfg:Hj
SESSION_DRIVER=database SESSION_DRIVER=database
SESSION_LIFETIME=120 SESSION_LIFETIME=120

46
app/Models/User.php Normal file
View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\View\Components;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class layout-admin extends Component
{
/**
* Create a new component instance.
*/
public function __construct()
{
//
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.layout-admin');
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\View\Components;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class tag extends Component
{
/**
* Create a new component instance.
*/
public function __construct()
{
//
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.tag');
}
}

View File

@ -13,7 +13,6 @@ return new class extends Migration
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');

View File

@ -43,6 +43,10 @@
, span , span
, ul, ol, li , ul, ol, li
, dl, dd, dt , dl, dd, dt
, form
, input
, textarea
, button
{ all : unset { all : unset
; margin : 0 ; margin : 0
; padding : 0 ; padding : 0
@ -366,13 +370,29 @@ figure > figcaption
input input
, button , button
, textarea
{ padding: 0.25rem 0.5rem
; border-radius: var(--mw)
; background: none
; color: var(--text)
}
button
{ background: var(--gray)
; color: var(--bg)
}
input
, button
{ box-shadow : inset 0 0 0 0.125rem #ddd } { box-shadow : inset 0 0 0 0.125rem #ddd }
input input
{ width : 14rem { width : 14rem
; padding : 0 1rem
} }
.buttons input[type="search"]
{ color : var(--bg) }
input[type="search"] + button input[type="search"] + button
{ margin-left : -3rem { margin-left : -3rem
; display : none ; display : none
@ -418,7 +438,7 @@ button
; grid-template-columns : 1fr 1fr ; grid-template-columns : 1fr 1fr
} }
.about .article
{ gap : 3rem { gap : 3rem
; display : grid ; display : grid
; grid-template-columns : 10rem 1fr ; grid-template-columns : 10rem 1fr
@ -426,7 +446,7 @@ button
; align-content: start ; align-content: start
} }
.about a .article a
, summary , summary
{ border-radius : 0.125rem { border-radius : 0.125rem
; text-decoration : underline ; text-decoration : underline
@ -440,9 +460,9 @@ button
, summary , summary
{ color : var(--green) } { color : var(--green) }
.about a:not(.th):active .article a:not(.th):active
, .about a:not(.th):focus , .article a:not(.th):focus
, .about a:not(.th):hover , .article a:not(.th):hover
{ background : var(--bg) { background : var(--bg)
; box-shadow: ; box-shadow:
0 0 0 0.125rem var(--bg) 0 0 0 0.125rem var(--bg)
@ -459,7 +479,7 @@ button
; color : var(--honey) ; color : var(--honey)
; font-weight : 500 ; font-weight : 500
} }
.about h3 .article h3
{ text-align : unset { text-align : unset
; margin-top: 1rem ; margin-top: 1rem
} }
@ -472,8 +492,8 @@ h2 a:any-link
, h2 a[href^='/']:any-link , h2 a[href^='/']:any-link
{ color : var(--honey) } { color : var(--honey) }
.about ul .article ul
, .about p , .article p
{ margin : 0 } { margin : 0 }
h1 + ul h1 + ul
@ -481,10 +501,10 @@ h2 a:any-link
, h3 + ul , h3 + ul
{ padding-top : 0 } { padding-top : 0 }
.about ul + h1 .article ul + h1
, .about ul + h2 , .article ul + h2
, .about ul + h3 , .article ul + h3
, .about ul > :last-child , .article ul > :last-child
{ padding-bottom : 0 } { padding-bottom : 0 }
ul ul
@ -547,7 +567,7 @@ ul > li::before
@media screen and (max-width : 600px) { @media screen and (max-width : 600px) {
.about .article
{ display : flex { display : flex
; flex-direction : column ; flex-direction : column
; gap : 1rem ; gap : 1rem
@ -558,11 +578,11 @@ ul > li::before
} }
} }
@media screen and (max-width : 800px) { @media screen and (max-width : 800px) {
.about .col-2 .article .col-2
{ display : flex } { display : flex }
} }
@media screen and (max-width : 1000px) { @media screen and (max-width : 1000px) {
.about .col-2.tablet-col-1 .article .col-2.tablet-col-1
{ display : flex } { display : flex }
} }

View File

@ -1,6 +1,6 @@
<x-layout> <x-layout>
<main class="about"> <main class="article">
<firugre class="thumbnail"> <firugre class="thumbnail">
<img src="/pages/about/photo.jpg" width="125" height="125" alt="photo"> <img src="/pages/about/photo.jpg" width="125" height="125" alt="photo">
</firugre> </firugre>

View File

@ -0,0 +1,3 @@
<x-layout-admin>
</x-layout-admin>

View File

@ -41,7 +41,7 @@
</div> </div>
<div class="about"> <div class="article">
<h2>/vis</h2> <h2>/vis</h2>
<ul> <ul>

View File

@ -0,0 +1,47 @@
<!doctype html>
<html lang="en" prefix="og: http://ogp.me/ns#"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf8">
<title>{{ request()->path() }}</title>
<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>
<body>
<nav class="c">
<div class="buttons round">
<x-nav-link class="orange">new</x-nav-link>
<x-nav-link class="gray">list</x-nav-link>
<x-nav-link class="pink">tags</x-nav-link>
<x-nav-link class="gray">collections</x-nav-link>
<x-nav-link class="gray">admin/list</x-nav-link>
</div>
</nav>
{{-- <?php
if ( $_SESSION['active']) {
echo $slot;
} else { ?>
--}}
<form class="col c" method="post" name="login_form">
<input type="email" name="email" placeholder="email">
<input type="password" name="password" placeholder="password">
<button onclick="login_form.submit()">Login</button>
</form>
{{ $slot }}
{{-- <?php } ?> --}}
<footer class="c">
<form class="buttons round c" method="get" name="search_form">
<input type="search" name="search">
<button onclick="search_form.submit()"
class="gray" title="search"
><span class="hidden">/</span>
</search>
</form>
</footer>
</body></html>

View File

@ -70,8 +70,8 @@
<footer class="c"> <footer class="c">
<div class="buttons round"> <div class="buttons round">
<a href="{{ str_starts_with(request()->path(), 'about') ? '/' : '/about/' }}" <a href="{{ str_starts_with(request()->path(), 'about') ? '/' : '/about/' }}"
class="bg-icon" title="about" class="bg-icon" title="{{ str_starts_with(request()->path(), 'about') ? '/' : 'about' }}"
><span class="hidden">about</span> ><span class="hidden">{{ str_starts_with(request()->path(), 'about') ? '/' : 'about' }}</span>
</a> </a>
</div> </div>
</footer> </footer>

View File

@ -0,0 +1,4 @@
<a href="'/tags/'.$slot.'/' }}"
aria-current="{{ str_starts_with(request()->path(), 'tags/'.$slot) ? 'true' : 'false' }}"
{{ $attributes->merge(['class' => str_starts_with(request()->path(), 'tags/'.$slot ) ? 'current' : '' ])}}
>{{ $slot }}</a>

View File

@ -0,0 +1,9 @@
<x-layout-admin>
<form>
<input type="text" name="slug">
<textarea name="body"></textarea>
<input type="submit">
</form>
</x-layout-admin>

View File

@ -6,7 +6,7 @@
<a href="/articles">/<span>articles</span></a> <a href="/articles">/<span>articles</span></a>
</aside> </aside>
<main class="about"> <main class="article">
<h1>2024</h1> <h1>2024</h1>
<section> <section>
<p>a groot start</p> <p>a groot start</p>

View File

@ -0,0 +1,7 @@
<x-layout>
<main class="article">
</main>
</x-layout>

View File

@ -0,0 +1,7 @@
<x-layout>
<main class="article">
</main>
</x-layout>

View File

@ -7,26 +7,41 @@ Route::get('/', function () {
}); });
Route::get('/about', function () { Route::name('about.show')->get('/about', function () {
return view('about'); return view('about');
}); });
Route::get('/graphics', function () { Route::get('/graphics', function () {
return view('graphics'); return view('graphics');
}); });
Route::get('/photos', function () { Route::get('/photos', function () {
return view('photos'); return view('photos');
}); });
Route::get('/comics', function () { Route::get('/comics', function () {
return view('comics'); return view('comics');
}); });
Route::get('/code', function () { Route::get('/code', function () {
return view('code'); return view('code');
}); });
Route::get('/notes', function () { Route::get('/notes', function () {
return view('code'); return view('notes');
}); });
Route::name('pages.list')->get('/list', function () {
return view('list');
});
Route::name('admin.new')->get('/new', function () {
return view('edit');
});
Route::name('admin.edit')->get('/edit/{slug}', function ($name) {
return view('edit');
})->where('slug', '[A-Za-z0-9-]+');
Route::name('admin.index')->get('/admin', function ($name = null) {
return view('admin');
});
Route::name('page.show')->get('/{slug}', function () {
return view('page');
})->where('slug', '[A-Za-z0-9-]+');