Skip to content

Commit

Permalink
CK editor done and blog post page modified
Browse files Browse the repository at this point in the history
  • Loading branch information
subhadipghorui committed Jan 24, 2021
1 parent 2bdb952 commit a36518f
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 199 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function store(Request $request)
public function show($id)
{
$post = Post::findOrFail($id);
return view('admin.post.show', compact('post'));
return view('post', compact('post'));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function search(Request $request)
{
$this->validate($request, ['search' => 'required|max:255']);
$search = $request->search;
$posts = Post::where('title', 'like', "%$search%")->paginate(10);
$posts = Post::where('title', 'like', "%$search%")->published()->paginate(10);
$posts->appends(['search' => $search]);

// $categories = Category::all();
Expand All @@ -65,7 +65,7 @@ public function search(Request $request)
public function tagPosts($name)
{
$query = $name;
$tags = Tag::where('name', 'like', "%$name%")->paginate(10);
$tags = Tag::where('name', 'like', "%$name%")->published()->paginate(10);
$tags->appends(['search' => $name]);

return view('tagPosts', compact('tags', 'query'));
Expand Down
7 changes: 3 additions & 4 deletions app/Notifications/NewPostNotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;

use Illuminate\Support\Str;
class NewPostNotify extends Notification implements ShouldQueue
{
use Queueable;
Expand Down Expand Up @@ -43,9 +43,8 @@ public function toMail($notifiable)
{
return (new MailMessage())
->subject('New Post Availabel')
->greeting('Hello Subscriber !')
->line('There is a new Post. Hope you will Like it :)')
->line('Post Title : '.$this->post->title)
->greeting('Title : '.$this->post->title)
->line('Category : '.$this->post->category->name)
->line('Author : '.$this->post->user->name)
->action('View Post', url(route('post', $this->post->slug)))
->line('Thank you.');
Expand Down
4 changes: 4 additions & 0 deletions public/backend/assets/toastr/jquery.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/backend/assets/toastr/toastr.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions public/backend/assets/toastr/toastr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 53 additions & 25 deletions resources/views/admin/post/create.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
@extends('layouts.backend.app')
@push('header')
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-lite.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-lite.min.js"></script>
<link rel="stylesheet" href="http://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css">
<script src="https://cdn.ckeditor.com/4.15.1/standard-all/ckeditor.js"></script>
@endpush
@section('content')
<div id="right-panel" class="right-panel">
Expand Down Expand Up @@ -72,7 +69,7 @@
</div>
<div class="form-group">
<label for="textarea-input" class=" form-control-label">Body [ for embedde google drive image use : https://drive.google.com/uc?export=view&id=file_id ]</label>
<textarea name="body" id="summernote" rows="9" placeholder="Content..." class="form-control"></textarea>
<textarea name="body" id="editor" rows="9" placeholder="Content..." class="form-control"></textarea>
</div>
<button type="submit" class="btn btn-primary">
<i class="fa fa-dot-circle-o"></i> Submit
Expand All @@ -87,33 +84,64 @@
@endsection

@push('footer')

<script>
$('#summernote').summernote({
tabsize: 2,
height: 300,
});
</script>
<script>
$(document).ready(function () {
CKEDITOR.addCss(
'body.document-editor { margin: 0.5cm auto; border: 1px #D3D3D3 solid; border-radius: 5px; background: white; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); }' +
'body.document-editor, div.cke_editable { width: 700px; padding: 1cm 2cm 2cm; } ' +
'body.document-editor table td > p, div.cke_editable table td > p { margin-top: 0; margin-bottom: 0; padding: 4px 0 3px 5px;} ' +
'blockquote { font-family: sans-serif, Arial, Verdana, "Trebuchet MS", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; } ');
CKEDITOR.replace('editor', {
extraPlugins: 'embed,autoembed,uploadimage,image2,codesnippet,colorbutton,font,justify,exportpdf,tableresize',
codeSnippet_theme: 'monokai_sublime',
height: 500,
(function ($) {
// Upload images to a CKFinder connector (note that the response type is set to JSON).
// uploadUrl: '/apps/ckfinder/3.4.5/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json',
$('#filter').keyup(function () {
// Configure your file manager integration. This example uses CKFinder 3 for PHP.
filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token=',
filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token=',
// The following options are not necessary and are used here for presentation purposes only.
// They configure the Styles drop-down list and widgets to use classes.
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
stylesSet: [{
name: 'Narrow image',
type: 'widget',
widget: 'image',
attributes: {
'class': 'image-narrow'
}
},
{
name: 'Wide image',
type: 'widget',
widget: 'image',
attributes: {
'class': 'image-wide'
}
},
],
})
// Load the default contents.css file plus customizations for this sample.
contentsCss: [
'http://cdn.ckeditor.com/4.15.1/full-all/contents.css',
'https://ckeditor.com/docs/ckeditor4/4.15.1/examples/assets/css/widgetstyles.css'
],
}(jQuery));
// Configure the Enhanced Image plugin to use classes instead of styles and to disable the
// resizer (because image size is controlled by widget styles or the image takes maximum
// 100% of the editor width).
image2_alignClasses: ['image-align-left', 'image-align-center', 'image-align-right'],
image2_disableResizer: true,
// Setup content provider. See https://ckeditor.com/docs/ckeditor4/latest/features/media_embed
embed_provider: '//ckeditor.iframe.ly/api/oembed?url={url}&callback={callback}',
bodyClass: 'document-editor',
});
</script>
<script src="http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script>
{!! Toastr::message() !!}
@endpush
Loading

0 comments on commit a36518f

Please sign in to comment.