mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-04-21 23:42:10 +02:00
Refactor the trash controller, add custom error views (WIP)
This commit is contained in:
parent
33f302799f
commit
1855d87715
@ -82,7 +82,7 @@ class TrashController extends Controller
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($entries)) {
|
||||
if ($entries->isEmpty()) {
|
||||
alert(trans('trash.delete_no_entries'), 'warning');
|
||||
return redirect()->back();
|
||||
}
|
||||
@ -124,16 +124,16 @@ class TrashController extends Controller
|
||||
}
|
||||
|
||||
if (empty($entry)) {
|
||||
abort(404);
|
||||
abort(404, trans('trash.restore.not_found'));
|
||||
}
|
||||
|
||||
if ($entry->user_id !== auth()->id()) {
|
||||
abort(403);
|
||||
abort(403, trans('trash.restore.not_allowed'));
|
||||
}
|
||||
|
||||
$entry->restore();
|
||||
|
||||
alert(trans('trash.delete_restore.' . $model), 'success');
|
||||
alert(trans('trash.restore.' . $model), 'success');
|
||||
|
||||
return redirect()->route('get-trash');
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ server {
|
||||
|
||||
# Error pages
|
||||
error_page 404 /index.php;
|
||||
error_page 403 /index.php;
|
||||
|
||||
# PHP handling
|
||||
location ~ \.php$ {
|
||||
|
@ -39,6 +39,7 @@ server {
|
||||
|
||||
# Error pages
|
||||
error_page 404 /index.php;
|
||||
error_page 403 /index.php;
|
||||
|
||||
# PHP handling
|
||||
location ~ \.php$ {
|
||||
|
@ -20,9 +20,12 @@ return [
|
||||
'delete_success.tags' => 'Permanently deleted all tags.',
|
||||
'delete_success.notes' => 'Permanently deleted all notes.',
|
||||
|
||||
'delete_restore.link' => 'Restored the link from trash.',
|
||||
'delete_restore.list' => 'Restored the list from trash.',
|
||||
'delete_restore.tag' => 'Restored the tag from trash.',
|
||||
'delete_restore.note' => 'Restored the note from trash.',
|
||||
'restore.link' => 'Restored the link from trash.',
|
||||
'restore.list' => 'Restored the list from trash.',
|
||||
'restore.tag' => 'Restored the tag from trash.',
|
||||
'restore.note' => 'Restored the note from trash.',
|
||||
|
||||
'restore.not_found' => 'The item to be restored could not be found.',
|
||||
'restore.not_allowed' => 'You are not allowed to restore this item.',
|
||||
|
||||
];
|
||||
|
5
resources/views/errors/401.blade.php
Normal file
5
resources/views/errors/401.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@extends('layouts.errors')
|
||||
|
||||
@section('title', __('Unauthorized'))
|
||||
@section('code', '401')
|
||||
@section('message', __($exception->getMessage() ?: 'Unauthorized'))
|
5
resources/views/errors/403.blade.php
Normal file
5
resources/views/errors/403.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@extends('layouts.errors')
|
||||
|
||||
@section('title', __('Forbidden'))
|
||||
@section('code', '403')
|
||||
@section('message', __($exception->getMessage() ?: 'Forbidden'))
|
5
resources/views/errors/404.blade.php
Normal file
5
resources/views/errors/404.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@extends('layouts.errors')
|
||||
|
||||
@section('title', __('Not Found'))
|
||||
@section('code', '404')
|
||||
@section('message', __($exception->getMessage() ?: 'Page not Found'))
|
5
resources/views/errors/419.blade.php
Normal file
5
resources/views/errors/419.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@extends('layouts.errors')
|
||||
|
||||
@section('title', __('Page Expired'))
|
||||
@section('code', '419')
|
||||
@section('message', __($exception->getMessage() ?: 'Page Expired'))
|
5
resources/views/errors/429.blade.php
Normal file
5
resources/views/errors/429.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@extends('layouts.errors')
|
||||
|
||||
@section('title', __('Too Many Requests'))
|
||||
@section('code', '429')
|
||||
@section('message', __($exception->getMessage() ?: 'Too Many Requests'))
|
5
resources/views/errors/500.blade.php
Normal file
5
resources/views/errors/500.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@extends('layouts.errors')
|
||||
|
||||
@section('title', __('Server Error'))
|
||||
@section('code', '500')
|
||||
@section('message', __($exception->getMessage() ?: 'Server Error'))
|
5
resources/views/errors/503.blade.php
Normal file
5
resources/views/errors/503.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@extends('layouts.errors')
|
||||
|
||||
@section('title', __('Service Unavailable'))
|
||||
@section('code', '503')
|
||||
@section('message', __($exception->getMessage() ?: 'Service Unavailable'))
|
43
resources/views/layouts/errors.blade.php
Normal file
43
resources/views/layouts/errors.blade.php
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>{{ config('app.name', 'LinkAce') }}</title>
|
||||
|
||||
<link href="{{ mix('assets/dist/css/app.css') }}" rel="stylesheet">
|
||||
|
||||
@include('partials.favicon')
|
||||
</head>
|
||||
<body class="setup">
|
||||
<div id="app">
|
||||
|
||||
<main class="main container">
|
||||
<div class="mb-5 text-center">
|
||||
<img src="{{ asset('assets/img/logo_linkace.svg') }}" alt="@lang('linkace.linkace')"
|
||||
width="150" height="55">
|
||||
</div>
|
||||
|
||||
<div class="card border-danger text-danger mb-3">
|
||||
<div class="card-header bg-danger text-white text-large">
|
||||
@yield('code') - @yield('title')
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@yield('message')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{{ redirect()->back()->getTargetUrl() }}">Go back</a>
|
||||
</main>
|
||||
|
||||
<script src="{{ mix('assets/dist/js/dependencies.js') }}"></script>
|
||||
<script src="{{ mix('assets/dist/js/app.js') }}"></script>
|
||||
<script src="{{ mix('assets/dist/js/fontawesome.js') }}"></script>
|
||||
@stack('scripts')
|
||||
|
||||
</div>
|
||||
<div id="loader"><div></div></div>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user