Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions app/Http/Controllers/Articles/AuthoredSeries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace App\Http\Controllers\Articles;

use App\Http\Controllers\Controller;
use App\Http\Middleware\Authenticate;
use App\Http\Middleware\RedirectIfUnconfirmed;
use Illuminate\Http\Request;

class AuthoredSeries extends Controller
{
public function __construct()
{
$this->middleware([Authenticate::class, RedirectIfUnconfirmed::class]);
}

public function __invoke(Request $request)
{
return view('users.series', [
'series' => $request->user()->series
]);
}
}
16 changes: 4 additions & 12 deletions app/Http/Controllers/Articles/SeriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ class SeriesController extends Controller
{
public function __construct()
{
$this->middleware([Authenticate::class, RedirectIfUnconfirmed::class], ['except' => ['index', 'show']]);
}

public function index()
{
}

public function show(Series $series)
{
$this->middleware([Authenticate::class, RedirectIfUnconfirmed::class], ['except' => ['index']]);
}

public function create()
Expand All @@ -42,7 +34,7 @@ public function store(SeriesRequest $request)

$this->success('series.created');

return redirect()->route('series.show', $series->slug());
return redirect()->route('user.series');
}

public function edit(Series $series)
Expand All @@ -62,7 +54,7 @@ public function update(SeriesRequest $request, Series $series)

$this->success('series.updated');

return redirect()->route('series.show', $series->slug());
return redirect()->route('user.series');
}

public function delete(Series $series)
Expand All @@ -73,6 +65,6 @@ public function delete(Series $series)

$this->success('series.deleted');

return redirect()->route('series');
return redirect()->route('user.series');
}
}
6 changes: 5 additions & 1 deletion database/seeds/ArticleSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class ArticleSeeder extends Seeder
{
public function run()
{
factory(Article::class, 50)->create(['author_id' => 1]);
factory(Article::class, 50)->create([
'author_id' => 1,
'submitted_at' => now(),
'approved_at' => now(),
]);
}
}
28 changes: 28 additions & 0 deletions resources/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,34 @@ nav.dashboard-nav a.active {
@apply border-green-primary text-green-primary;
}

.nav a {
@apply border-transparent text-gray-500;
}

.nav a:hover {
@apply text-gray-700 border-green-primary;
}

.nav a.active {
@apply border-green-primary text-gray-900;
}

.nav a.active:focus {
@apply border-green-dark;
}

.nav .dropdown a {
@apply block px-4 py-2 text-sm leading-5 text-gray-700 transition duration-150 ease-in-out;
}

.nav .dropdown a:hover {
@apply bg-gray-100;
}

.nav .dropdown a:focus {
@apply outline-none bg-gray-100;
}

a > span > em {
@apply bg-green-light;
}
Expand Down
19 changes: 11 additions & 8 deletions resources/css/labels.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@
@apply px-2 py-1 rounded text-xs uppercase bg-gray-300 text-gray-700 px-2 py-1 cursor-pointer;
}

.label:hover {
@apply bg-gray-400;
a.label:hover,
button.label:hover {
@apply bg-gray-400 no-underline;
}

span.label:hover {
@apply cursor-auto;
}

.label-primary {
@apply bg-green-primary text-white;
}

.label-primary:hover {
a.label-primary:hover,
button.label-primary:hover {
@apply bg-green-dark;
}

.label-danger {
@apply bg-red-primary text-white;
}

.label-danger:hover {
a.label-danger:hover,
button.label-danger:hover {
@apply bg-red-dark;
}

a.label:hover {
@apply no-underline;
}
2 changes: 1 addition & 1 deletion resources/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
function active($routes, bool $condition = true): string
{
return call_user_func_array([app('router'), 'is'], (array) $routes) && $condition ? ' border-green-primary focus:border-green-dark text-gray-900' : ' border-transparent text-gray-500 hover:text-gray-700 hover:border-green-primary';
return call_user_func_array([app('router'), 'is'], (array) $routes) && $condition ? 'active' : '';
}
}

Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
'users.unbanned' => ':0 was unbanned!',
'users.deleted' => ':0 was deleted and all of their content was removed!',
'articles.approved' => 'The article has been approved and is live on the site.',
'articles.approved' => 'The article has been disapproved and removed from the site.',
'articles.disapproved' => 'The article has been disapproved and removed from the site.',
];
2 changes: 1 addition & 1 deletion resources/views/admin/articles.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
</div>

<div class="container mx-auto px-4 pt-4 flex flex-wrap flex-col-reverse md:flex-row">
<div class="container mx-auto p-4 flex flex-wrap flex-col-reverse md:flex-row">
<div class="w-full md:w-3/4 md:pr-3">
<table class="table table-striped mt-8">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/admin/overview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
</div>

<div class="container mx-auto px-4 pt-4 flex flex-wrap flex-col-reverse md:flex-row">
<div class="container mx-auto p-4 flex flex-wrap flex-col-reverse md:flex-row">
<div class="w-full md:w-3/4 md:pr-3">
<table class="table table-striped mt-8">
<thead>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/admin/partials/_navigation.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<ul class="tags">
<li>
<li class="{{ active('admin') }}">
<a href="{{ route('admin') }}">
Users
</a>
</li>
<li>
<li class="{{ active('admin.articles') }}">
<a href="{{ route('admin.articles') }}">
Articles
</a>
Expand Down
12 changes: 6 additions & 6 deletions resources/views/articles/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
@endpush

@section('content')
<div class="max-w-screen-md mx-auto p-4 pt-8">
<div class="max-w-screen-md mx-auto px-4 py-8 mb-8">
<h1 class="text-4xl tracking-tight leading-10 font-extrabold text-gray-900 sm:leading-none mb-4">{{ $article->title() }}</h1>

@if ($article->isNotPublished())
@if($article->isAwaitingApproval())
<span class="label inline-flex mb-4">
Awaiting Approval
</span>
@can(App\Policies\ArticlePolicy::APPROVE, $article)
<button type="button" class="label label-primary inline-flex mb-4" @click.prevent="activeModal = 'approveArticle'">
Approve
</button>
@endcan
@else
<span class="label inline-flex mb-4">
Draft
</span>
@endif

@can(App\Policies\ArticlePolicy::APPROVE, $article)
<button type="button" class="label label-primary inline-flex mb-4" @click.prevent="activeModal = 'approveArticle'">
Approve
</button>
@endcan
@else
@can(App\Policies\ArticlePolicy::DISAPPROVE, $article)
<button type="button" class="label label-danger inline-flex mb-4" @click.prevent="activeModal = 'disapproveArticle'">
Expand Down
44 changes: 22 additions & 22 deletions resources/views/layouts/_nav.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<nav x-data="{ open: false }" class="bg-white shadow">
<nav x-data="{ open: false }" class="nav bg-white shadow">
<div class="container mx-auto px-4">
<div class="flex justify-between h-16">
<div class="flex px-2 lg:px-0">
Expand Down Expand Up @@ -28,11 +28,11 @@
</svg>
</button>
</div>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50" x-cloak>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="dropdown absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50" x-cloak>
<div class="py-1 rounded-md bg-white shadow-xs">
<a href="https://discord.gg/KxwQuKb" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Discord</a>
<a href="https://larachat.co" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Larachat</a>
<a href="https://webchat.freenode.net/?nick=laravelnewbie&channels=%23laravel&prompt=1" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">IRC</a>
<a href="https://discord.gg/KxwQuKb">Discord</a>
<a href="https://larachat.co">Larachat</a>
<a href="https://webchat.freenode.net/?nick=laravelnewbie&channels=%23laravel&prompt=1">IRC</a>
</div>
</div>
</div>
Expand All @@ -49,16 +49,16 @@
</svg>
</button>
</div>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50" x-cloak>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="dropdown absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50" x-cloak>
<div class="py-1 rounded-md bg-white shadow-xs">
<a href="https://github.com/laravelio" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Github</a>
<a href="https://larachat.co" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Twitter</a>
<a href="https://github.com/laravelio">Github</a>
<a href="https://larachat.co">Twitter</a>
<div class="border-t border-gray-100"></div>
<a href="https://laravel.com" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Laravel</a>
<a href="https://laracasts.com" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Laracasts</a>
<a href="https://laravel-news.com" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Laravel News</a>
<a href="https://www.laravelpodcast.com" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Podcast</a>
<a href="https://ecosystem.laravel.io" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">Ecosystem</a>
<a href="https://laravel.com">Laravel</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">Laravel News</a>
<a href="https://www.laravelpodcast.com">Podcast</a>
<a href="https://ecosystem.laravel.io">Ecosystem</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -100,30 +100,30 @@
<img class="h-8 w-8 rounded-full" src="{{ Auth::user()->gravatarUrl(256) }}" alt="{{ Auth::user()->name() }}" />
</button>
</div>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50" x-cloak>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="dropdown origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50" x-cloak>
<div class="py-1 rounded-md bg-white shadow-xs">
<a href="{{ route('profile', Auth::user()->username()) }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">
<a href="{{ route('profile', Auth::user()->username()) }}">
Your Profile
</a>
<a href="{{ route('dashboard') }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">
<a href="{{ route('dashboard') }}">
Dashboard
</a>
<a href="{{ route('user.articles') }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">
Articles
<a href="{{ route('user.articles') }}">
My Articles
</a>
<a href="{{ route('settings.profile') }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">
<a href="{{ route('settings.profile') }}">
Settings
</a>

@can(App\Policies\UserPolicy::ADMIN, App\User::class)
<div class="border-t border-gray-100"></div>
<a href="{{ route('admin') }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">
<a href="{{ route('admin') }}">
Admin
</a>
@endcan

<div class="border-t border-gray-100"></div>
<a href="{{ route('logout') }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out">
<a href="{{ route('logout') }}">
Sign out
</a>
</div>
Expand Down Expand Up @@ -203,7 +203,7 @@
Dashboard
</a>
<a href="{{ route('user.articles') }}" class="mt-1 block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100 focus:outline-none focus:text-gray-800 focus:bg-gray-100 transition duration-150 ease-in-out">
Articles
My Articles
</a>
<a href="{{ route('settings.profile') }}" class="mt-1 block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100 focus:outline-none focus:text-gray-800 focus:bg-gray-100 transition duration-150 ease-in-out">
Settings
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/show-articles.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="container mx-auto px-4 pt-4 flex flex-wrap flex-col-reverse lg:flex-row">
<div class="container mx-auto px-4 pt-4 flex flex-wrap flex-col-reverse lg:flex-row mb-8">
<div class="w-full lg:w-3/4 py-8 lg:pr-4">
<div wire:loading class="flex w-full h-full text-2xl text-gray-700">
Loading...
Expand Down
2 changes: 1 addition & 1 deletion resources/views/series/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="container mx-auto p-4 flex justify-center">
<div class="w-full md:w-2/3 xl:w-1/2">
<div class="md:p-4 md:border-2 md:rounded md:bg-gray-100">
@include('articles.series._form', [
@include('series._form', [
'route' => ['series.update', $series->id()],
'method' => 'PUT',
])
Expand Down
Loading