Form Modification – WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (12)

WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (12) – Form Modification

In this twelfth part of creating WordPress-Like Blog using Laravel 5.7 and AdminLTE 3, we will :

  1. Use jquery to fill the slug text field
  2. Using simplemde.com library for the excerpt and body field
  3. Preview Image Upload using Jasny Bootstrap Plugin
  4. Reorganize the Create Post Form to have a WordPress-Like feel

Fill the slug text field

From the existing form, we will add a jquery script in order to fill the slug field automatically when the title field has been entered. First, open resources/views/backend/blog/create.blade.php and add a jquery code to the script section :

Using SimpleMDE Library for Excerpt and Body Field

Open simplemde.com and download the zip file. Extract the zip file, rename the dist folder to ‘simplemde’, and move it to public/backend/plugin directory.

Open main.blade.php inside resource/views/layouts/backend directory and add the simplemde css and custom.css

and the javascript

Then, open create.blade.php and add the following lines into script section :

Now open the form, you will see the icons on the top field of excerpt and the body field :

Membuat Blog dengan Laravel 5.7 dan AdminLTE 3 (12) – Modifikasi Form

Let’s reduce the height of excerpt field, by adding these lines to the backend/css/custom.css.

Add excerpt class to excerpt field in create.blade.php

Now the height has been reduced.

Preview Image Upload Using Jasny Bootstrap Plugin

At the moment, if we upload image within a post, we won’t see the preview. With jasny plugin, we will change this. Copy the css and javascript files of this plugin to the main.blade.php.

Modify create.blade.php at the file upload field section :

Membuat Blog dengan Laravel 5.7 dan AdminLTE 3 (12) – Modifikasi Form2

Reorganize the Create Post Form

To create a wordpress feel for the create post form, let’s change the entire create.blade.php with the following :

Here is the end result :

Membuat Blog dengan Laravel 5.7 dan AdminLTE 3 (12) – Modifikasi Form 3

Github commit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.