v0.5.5 - Added news on the admin panel

This commit is contained in:
frederikpyt
2020-08-06 12:21:19 +02:00
parent ab4275dc33
commit 3e4e6e71ab
12 changed files with 340 additions and 0 deletions
@@ -17,6 +17,9 @@
<div class="segment">
<h3 class="text-white"><a href="{{ route("roles.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Roller</span></a></h3>
</div>
<div class="segment">
<h3 class="text-white"><a href="{{ route("news.index")}}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Nyheder</span></a></h3>
</div>
<div class="segment">
<h3 class="text-white"><a href="{{ route("menu-plans.index")}}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Menuplan</span></a></h3>
</div>
@@ -0,0 +1,41 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Opret Nyheder
@endsection
@section("path")
<a href="{{ route('news.create') }}" class="text-white">Opret Nyheder</a> /
@endsection
@section("content")
<style>
.ck-editor__main {
margin-bottom: 1rem;
}
</style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script>
<h1>Opret Nyhed</h1>
<form method="post" action="{{ route("news.store") }}">
@csrf
<label for="title">Titel nyheden:</label>
<input type="text" name="name" id="title" placeholder="OBS: Menuplanen er ændret" required>
<textarea name="content" id="editor"></textarea>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
<script>
ClassicEditor
.create( document.querySelector( '#editor' ) )
.then( editor => {
console.log( editor );
} )
.catch( error => {
console.error( error );
} );
</script>
@endsection
@@ -0,0 +1,13 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Vejledning - Fjern
@endsection
@section("path")
<a href="{{ route('guides.delete') }}" class="text-white">Fjern Guide</a> /
@endsection
@section("content")
@endsection
@@ -0,0 +1,46 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Nyhed - Rediger
@endsection
@section("path")
<a href="{{route('news.edit', ['news' => $news])}}" class="text-white">Rediger nyhed</a> /
@endsection
@section("content")
<style>
.ck-editor__main {
margin-bottom: 1rem;
}
</style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script>
<h1>Rediger nyhed:</h1>
<form method="post" action="{{route("news.update", ["news" => $news])}}">
@csrf
@method("PUT")
<label for="title">Navn</label>
<input value="{{$news->name}}" type="text" name="name" id="title" required>
<textarea name="content" id="editor">{{$news->content}}</textarea>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
<script>
ClassicEditor
.create( document.querySelector( '#editor' ), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ],
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h3', title: 'Heading 1', class: 'sde-blue' },
{ model: 'heading2', view: 'h4', title: 'Heading 2', class: 'sde-blue' }
]
}
} )
.catch( error => {
console.log( error );
} );
</script>
@endsection
@@ -0,0 +1,38 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Opret Nyhed
@endsection
@section("path")
<a href="{{ route('news.index') }}" class="text-white">Opret Nyheder</a> /
@endsection
@section("content")
<div class="row align-items-center">
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('news.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Nyheder</a>
</div>
<table class="tbl mt-2">
<tr>
<th>Navn</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($news as $new)
<tr>
<td>{{$new->name}}</td>
<td><a href="{{ route("news.edit", [ "news" => $new ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("news.destroy", [ "news" => $new ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>
@endforeach
</table>
{{ $news->links() }}
@endsection
@@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Vejledning - Opret
@endsection
@section("path")
<a href="{{ route('guides.create') }}" class="text-white">Opret vejledning</a> /
@endsection
@section("content")
vejledning blev (ikke) oprettet.
@endsection
@@ -0,0 +1,14 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Vejledning - Rediger
@endsection
@section("path")
<a href="{{ route('guides.edit', ["guide" => $link]) }}" class="text-white">Vejledning</a> /
@endsection
@section("content")
Din vejledning blev (ikke) redigeret.
@endsection