Initial commit

This commit is contained in:
2021-09-16 20:27:51 +08:00
commit 5ed6195cc1
41 changed files with 3429 additions and 0 deletions

View File

@ -0,0 +1,5 @@
<div class="footer">
<div class="container">
<h4 class="text-secondary">Blog App</h4>
</div>
</div>

View File

@ -0,0 +1,30 @@
<div class="header">
<div class="container">
@section('header')
<h4><a href="/" class="title text-dark">Blog App</a></h4>
@show
@if(isset($_SESSION['is_auth']))
<form method="POST" action="/user/logout" class="float-right">
<input type="hidden" name="_token" value="{{ $_SESSION['_token'] }}">
<button type="submit" class="btn btn-dark">Logout</button>
</form>
<div class="float-right">
<a href="/post/create" class="post-create btn btn-success">New Post</a>
</div>
@else
@if(! preg_match('/\/register$/', $_SERVER['REQUEST_URI']))
<div class="float-right">
<a href="/user/register" class="register btn btn-info">Register</a>
</div>
@endif
@if(! preg_match('/\/login$/', $_SERVER['REQUEST_URI']))
<div class="float-right">
<a href="/user/login" class="login btn btn-light">Login</a>
</div>
@endif
@endif
<div class="float-right">
<input type="text" placeholder="Search title ..." id="search" class="search form-control" value="{{ isset($keyword) ? urldecode($keyword) : '' }}">
</div>
</div>
</div>

View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>@yield('title')Blog App</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="/css/main.css">
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/all.js" integrity="sha384-xymdQtn1n3lH2wcu0qhcdaOpQwyoarkgLVxC/wZ5q7h9gHtxICrpcaSUfygqZGOe" crossorigin="anonymous"></script>
</head>
<body>
@include('layout.header')
<div class="container">
<div class="row">
<div class="main col">
@if(isset($errors))
<ul class="errors alert alert-danger">
@foreach($errors as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@endif
@if(isset($messages))
<ul class="messages alert alert-info">
@foreach($messages as $message)
<li>{{ $message }}</li>
@endforeach
</ul>
@endif
@yield('content')
@yield('comments')
</div>
<div class="sidebar col-lg-3">
@yield('sidebar')
</div>
</div>
</div>
@include('layout.footer')
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="/js/main.js"></script>
</body>
</html>

View File

@ -0,0 +1,19 @@
@if(isset($_SESSION['is_auth']))
<img src="https://www.gravatar.com/avatar/{{ md5(strtolower(trim($_SESSION['email']))) }}?s=50&d=mm&r=pg" class="avatar">
<a href="/user/settings" class="user-setting" title="Settings">
<i class="fas fa-cog gear"></i>
</a>
<h4>
<a href="/user/{{ $_SESSION['username'] }}" class="user-info">
{{ $_SESSION['username'] }}
</a>
</h4>
@endif
@if(isset($tags))
<ul class="tags">
@foreach($tags as $tag)
<li><a href="/tag/{{ $tag->id }}">{{ $tag->keyword }}</a> ({{ $tag->num_of_posts }})</li>
@endforeach
</ul>
@endif