v0.7.8 - Added Quill Editor to all sites - Fixed Event name/subname showance in news.index

This commit is contained in:
Anders 2020-08-12 08:42:58 +02:00
parent 511e0b783f
commit 746926d439
13 changed files with 261 additions and 113 deletions

View File

@ -50,11 +50,12 @@ class NewsController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
$data = $request->validate([ $data = $request->validate([
"name" => "required", "subname" => "required",
"content" => "required" "content" => "required"
]); ]);
$news = new News($data); $news = new News($data);
$news->name = "";
$news->save(); $news->save();
return redirect()->route("news.index"); return redirect()->route("news.index");

View File

@ -6977,6 +6977,22 @@ main {
display: inline-block; display: inline-block;
} }
.ql-align-left {
text-align: left !important;
}
.ql-align-center {
text-align: center !important;
}
.ql-align-right {
text-align: right !important;
}
.ql-align-justify {
text-align: justify !important;
}
#snackbar { #snackbar {
visibility: hidden; visibility: hidden;
width: calc(90% - 16px); width: calc(90% - 16px);

View File

@ -6977,6 +6977,22 @@ main {
display: inline-block; display: inline-block;
} }
.ql-align-left {
text-align: left !important;
}
.ql-align-center {
text-align: center !important;
}
.ql-align-right {
text-align: right !important;
}
.ql-align-justify {
text-align: justify !important;
}
#snackbar { #snackbar {
visibility: hidden; visibility: hidden;
width: calc(90% - 16px); width: calc(90% - 16px);

View File

@ -486,6 +486,22 @@ $primary-color: $blue;
} }
} }
.ql-align-left {
text-align: left !important;
}
.ql-align-center {
text-align: center !important;
}
.ql-align-right {
text-align: right !important;
}
.ql-align-justify {
text-align: justify !important;
}
#snackbar { #snackbar {
visibility: hidden; visibility: hidden;
width: calc(90% - 16px); width: calc(90% - 16px);

View File

@ -17,6 +17,10 @@
.toggle__text::before { .toggle__text::before {
border-color: black; border-color: black;
} }
#editor {
margin-bottom: 1rem;
}
</style> </style>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Opret Aktivitet:</h1> <h1>Opret Aktivitet:</h1>
@ -51,7 +55,7 @@
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ], [{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }], [{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }], [ {'direction': 'rtl'}, { 'align': [] }],
[ 'link', 'image', 'video', 'formula' ], [ 'link' ],
[ 'clean' ] [ 'clean' ]
], ],
}, },

View File

@ -17,6 +17,10 @@
.toggle__text::before { .toggle__text::before {
border-color: black; border-color: black;
} }
#editor {
margin-bottom: 1rem;
}
</style> </style>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Rediger Link:</h1> <h1>Rediger Link:</h1>
@ -53,7 +57,7 @@
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ], [{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }], [{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }], [ {'direction': 'rtl'}, { 'align': [] }],
[ 'link', 'image', 'video', 'formula' ], [ 'link' ],
[ 'clean' ] [ 'clean' ]
], ],
}, },

View File

@ -11,23 +11,25 @@
@section("content") @section("content")
<style> <style>
.ck-editor__main {
margin-bottom: 1rem;
}
.toggle__label::before, .toggle__label::after { .toggle__label::before, .toggle__label::after {
border-color: black; border-color: black;
} }
.toggle__text::before { .toggle__text::before {
border-color: black; border-color: black;
} }
#editor {
margin-bottom: 1rem;
}
</style> </style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Opret Vejledning</h1> <h1>Opret Vejledning</h1>
<form method="post" action="{{ route("guides.store") }}"> <form method="post" action="{{ route("guides.store") }}">
@csrf @csrf
<label for="title">Titel guiden</label> <label for="title">Titel guiden</label>
<input type="text" name="name" id="title" required> <input type="text" name="name" id="title" required>
<textarea name="guide_articles" id="editor"></textarea> <div id="editor"></div>
<textarea name="guide_articles" class="d-none" id="hiddenArea"></textarea>
<label class="toggle"> <label class="toggle">
<input class="toggle__input" type="checkbox" name="newsoption"> <input class="toggle__input" type="checkbox" name="newsoption">
<span class="toggle__label"> <span class="toggle__label">
@ -37,19 +39,33 @@
<input type="submit" class="btn btn-dark text-white" value="Opret"> <input type="submit" class="btn btn-dark text-white" value="Opret">
</form> </form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script> <script>
ClassicEditor var container = document.getElementById("editor");
.create( document.querySelector( '#editor' ) ) var fullEditor = new Quill(container, {
.then( editor => { modules: {
console.log( editor ); 'toolbar': [
} ) [ 'bold', 'italic', 'underline', 'strike' ],
.catch( error => { [{ 'color': [] }, { 'background': [] }],
console.error( error ); [{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }],
[ 'link' ],
[ 'clean' ]
],
},
theme: 'snow'
}); });
</script> </script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
}
</script>
@endsection @endsection
@section("scripts") @section("scripts")
<script> <script>

View File

@ -11,17 +11,18 @@
@section("content") @section("content")
<style> <style>
.ck-editor__main {
margin-bottom: 1rem;
}
.toggle__label::before, .toggle__label::after { .toggle__label::before, .toggle__label::after {
border-color: black; border-color: black;
} }
.toggle__text::before { .toggle__text::before {
border-color: black; border-color: black;
} }
#editor {
margin-bottom: 1rem;
}
</style> </style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Rediger vejledning:</h1> <h1>Rediger vejledning:</h1>
<form method="post" action="{{route("guides.update", ["guide" => $guide])}}"> <form method="post" action="{{route("guides.update", ["guide" => $guide])}}">
@csrf @csrf
@ -29,7 +30,8 @@
<label for="title">Navn</label> <label for="title">Navn</label>
<input value="{{$guide->name}}" type="text" name="name" id="title" required> <input value="{{$guide->name}}" type="text" name="name" id="title" required>
<label for="editor">Vejledning</label> <label for="editor">Vejledning</label>
<textarea name="guide_articles" id="editor">{{$guide->guide_articles}}</textarea> <div id="editor">{!! $guide->guide_articles !!}</div>
<textarea name="guide_articles" class="d-none" id="hiddenArea"></textarea>
<label class="toggle"> <label class="toggle">
<input class="toggle__input" type="checkbox" name="newsoption"> <input class="toggle__input" type="checkbox" name="newsoption">
<span class="toggle__label"> <span class="toggle__label">
@ -39,22 +41,33 @@
<input type="submit" class="btn btn-dark text-white" value="Rediger"> <input type="submit" class="btn btn-dark text-white" value="Rediger">
</form> </form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script> <script>
ClassicEditor var container = document.getElementById("editor");
.create( document.querySelector( '#editor' ), { var fullEditor = new Quill(container, {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ], modules: {
heading: { 'toolbar': [
options: [ [ 'bold', 'italic', 'underline', 'strike' ],
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' }, [{ 'color': [] }, { 'background': [] }],
{ model: 'heading1', view: 'h3', title: 'Heading 1', class: 'sde-blue' }, [{ 'script': 'super' }, { 'script': 'sub' }],
{ model: 'heading2', view: 'h4', title: 'Heading 2', class: 'sde-blue' }, [{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
] [{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
} [ {'direction': 'rtl'}, { 'align': [] }],
} ) [ 'link' ],
.catch( error => { [ 'clean' ]
console.log( error ); ],
},
theme: 'snow'
}); });
</script> </script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
}
</script>
@endsection @endsection
@section("scripts") @section("scripts")
<script> <script>

View File

@ -18,25 +18,30 @@
border-color: black; border-color: black;
} }
.tox-notification { #editor {
display: none !important;
}
.tox {
border-radius: 4px !important;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
</style> </style>
<script src="https://cdn.tiny.cloud/1/ikwmbvigw8ass90tn37xiql6mk1gjoks77t3m6tld60hdjov/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Opret Menuplan:</h1> <h1>Opret Menuplan:</h1>
<form action="{{ action('MenuPlanController@store') }}" method="post"> <form action="{{ action('MenuPlanController@store') }}" method="post">
@csrf @csrf
<label for="week">Uge nr.</label> <label for="week">Uge nr.</label>
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required> <input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
<textarea name="menu" id="editor"><p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Mandag:<br /></span><span style="text-align: center;">{Mandag}</span></p> <div id="editor">
<p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Tirsdag:<br /></span><span style="text-align: center;">{Tirsdag}</span></p> <h2 class="ql-align-center"><strong style="color: rgb(0, 120, 138);">Mandag:</strong></h2>
<p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Onsdag:<br /></span><span style="text-align: center;">{Onsdag}</span></p> <p class="ql-align-center">{Mandag}</p>
<p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Torsdag:<br /></span><span style="text-align: center;">{Torsdag}</span></p></textarea> <p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong style="color: rgb(0, 120, 138);">Tirsdag:</strong></h2>
<p class="ql-align-center">{Tirsdag}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong style="color: rgb(0, 120, 138);">Onsdag:</strong></h2>
<p class="ql-align-center">{Onsdag}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong style="color: rgb(0, 120, 138);">Torsdag:</strong></h2>
<p class="ql-align-center">{Torsdag}</p>
</div>
<textarea name="menu" class="d-none" id="hiddenArea"></textarea>
<label class="toggle"> <label class="toggle">
<input class="toggle__input" type="checkbox" name="newsoption"> <input class="toggle__input" type="checkbox" name="newsoption">
<span class="toggle__label"> <span class="toggle__label">
@ -46,15 +51,32 @@
<input type="submit" class="btn btn-dark text-white" value="Opret Menuplan"> <input type="submit" class="btn btn-dark text-white" value="Opret Menuplan">
</form> </form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script> <script>
tinymce.init({ var container = document.getElementById("editor");
selector: 'textarea', var fullEditor = new Quill(container, {
setup: function (editor) { modules: {
editor.on('change', function () { 'toolbar': [
tinymce.triggerSave(); [ 'bold', 'italic', 'underline', 'strike' ],
[{ 'color': ['#ffffff-#000000'] }, { 'background': [] }],
[{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }],
[ 'link' ],
[ 'clean' ]
],
},
theme: 'snow'
}); });
</script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
} }
});
</script> </script>
@endsection @endsection
@section("scripts") @section("scripts")

View File

@ -18,23 +18,19 @@
border-color: black; border-color: black;
} }
.tox-notification { #editor {
display: none !important;
}
.tox {
border-radius: 4px !important;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
</style> </style>
<script src="https://cdn.tiny.cloud/1/ikwmbvigw8ass90tn37xiql6mk1gjoks77t3m6tld60hdjov/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Rediger Menuplan:</h1> <h1>Rediger Menuplan:</h1>
<form method="post" action="{{ route("menu-plans.update", [ "menu_plan" => $menuplan ]) }}"> <form method="post" action="{{ route("menu-plans.update", [ "menu_plan" => $menuplan ]) }}">
@csrf @csrf
@method("PUT") @method("PUT")
<label for="mandag">Uge:</label> <label for="mandag">Uge:</label>
<input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required> <input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required>
<textarea name="menu" id="editor">{!! $menuplan->menu !!}</textarea> <div id="editor">{!! $menuplan->menu !!}</div>
<textarea name="menu" class="d-none" id="hiddenArea"></textarea>
<label class="toggle"> <label class="toggle">
<input class="toggle__input" type="checkbox" name="newsoption"> <input class="toggle__input" type="checkbox" name="newsoption">
<span class="toggle__label"> <span class="toggle__label">
@ -44,15 +40,32 @@
<input type="submit" class="btn btn-dark text-white" value="Rediger Menuplan"> <input type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
</form> </form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script> <script>
tinymce.init({ var container = document.getElementById("editor");
selector: 'textarea', var fullEditor = new Quill(container, {
setup: function (editor) { modules: {
editor.on('change', function () { 'toolbar': [
tinymce.triggerSave(); [ 'bold', 'italic', 'underline', 'strike' ],
[{ 'color': [] }, { 'background': [] }],
[{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }],
[ 'link' ],
[ 'clean' ]
],
},
theme: 'snow'
}); });
</script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
} }
});
</script> </script>
@endsection @endsection
@section("scripts") @section("scripts")

View File

@ -11,32 +11,48 @@
@section("content") @section("content")
<style> <style>
.ck-editor__main { #editor {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
</style> </style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Opret Nyhed</h1> <h1>Opret Nyhed</h1>
<form method="post" action="{{ route("news.store") }}"> <form method="post" action="{{ route("news.store") }}">
@csrf @csrf
<label for="title">Titel nyheden:</label> <label for="title">Titel nyheden:</label>
<input type="text" name="name" id="title" placeholder="OBS: Menuplanen er ændret" required> <input type="text" name="subname" id="title" placeholder="OBS: Menuplanen er ændret" required>
<textarea name="content" id="editor"></textarea> <div id="editor"></div>
<textarea name="content" class="d-none" id="hiddenArea"></textarea>
<input type="submit" class="btn btn-dark text-white" value="Opret"> <input type="submit" class="btn btn-dark text-white" value="Opret">
</form> </form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script> <script>
ClassicEditor var container = document.getElementById("editor");
.create( document.querySelector( '#editor' ) ) var fullEditor = new Quill(container, {
.then( editor => { modules: {
console.log( editor ); 'toolbar': [
} ) [ 'bold', 'italic', 'underline', 'strike' ],
.catch( error => { [{ 'color': [] }, { 'background': [] }],
console.error( error ); [{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }],
[ 'link' ],
[ 'clean' ]
],
},
theme: 'snow'
}); });
</script> </script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
}
</script>
@endsection @endsection
@section("scripts") @section("scripts")

View File

@ -11,37 +11,48 @@
@section("content") @section("content")
<style> <style>
.ck-editor__main { #editor {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
</style> </style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script> <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Rediger nyhed:</h1> <h1>Rediger nyhed:</h1>
<form method="post" action="{{route("news.update", ["news" => $news])}}"> <form method="post" action="{{route("news.update", ["news" => $news])}}">
@csrf @csrf
@method("PUT") @method("PUT")
<label for="title">Navn</label> <label for="title">Navn</label>
<input value="{{$news->name}}" type="text" name="name" id="title" required> <input value="{{$news->name}}" type="text" name="subname" id="title" required>
<textarea name="content" id="editor">{{$news->content}}</textarea> <div id="editor">{!! $news->content !!}</div>
<textarea name="content" class="d-none" id="hiddenArea"></textarea>
<input type="submit" class="btn btn-dark text-white" value="Rediger"> <input type="submit" class="btn btn-dark text-white" value="Rediger">
</form> </form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script> <script>
ClassicEditor var container = document.getElementById("editor");
.create( document.querySelector( '#editor' ), { var fullEditor = new Quill(container, {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ], modules: {
heading: { 'toolbar': [
options: [ [ 'bold', 'italic', 'underline', 'strike' ],
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' }, [{ 'color': [] }, { 'background': [] }],
{ model: 'heading1', view: 'h3', title: 'Heading 1', class: 'sde-blue' }, [{ 'script': 'super' }, { 'script': 'sub' }],
{ model: 'heading2', view: 'h4', title: 'Heading 2', class: 'sde-blue' } [{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
] [{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
} [ {'direction': 'rtl'}, { 'align': [] }],
} ) [ 'link' ],
.catch( error => { [ 'clean' ]
console.log( error ); ],
},
theme: 'snow'
}); });
</script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
}
</script> </script>
@endsection @endsection
@section("scripts") @section("scripts")

View File

@ -21,7 +21,7 @@
</tr> </tr>
@foreach($news as $new) @foreach($news as $new)
<tr> <tr>
<td>{{$new->name}}</td> <td>{{$new->subname}}</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><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"> <td><form method="post" action="{{ route("news.destroy", [ "news" => $new ]) }}" class="w-100 nostyle">
@csrf @csrf