Skip to content

Commit

Permalink
Improved user feedback on blogpost forms
Browse files Browse the repository at this point in the history
  • Loading branch information
ttimot24 committed Nov 14, 2024
1 parent c7fa438 commit 3509098
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
7 changes: 6 additions & 1 deletion app/Libs/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

namespace App\Libs;

/**
* @deprecated deprecated since version 1.0.0
*/
class PluginManager extends Model{


/**
* @deprecated deprecated since version 1.0.0
*/
public static function area($area_num){

foreach(app()->plugins as $widget){
Expand Down
1 change: 1 addition & 0 deletions app/Model/Blogpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Blogpost extends Model

public static $rules = [
'title' => 'required',
'summary' => 'max:255',
'category_id' => 'required'
];

Expand Down
34 changes: 23 additions & 11 deletions app/View/blogposts/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@

<div class="col-xs-12 col-md-8">

<div class='form-group pull-left col-12'>
<label for='title'>{{ trans('blogpost.title') }}:</label>
<input type='text' class='form-control' id='title' name='title'
<div class='form-group col mb-4'>
<label for='title'>{{ trans('blogpost.title') }}</label>
<input type='text' class='form-control @error('title') is-invalid @enderror' id='title' name='title'
value="{{ old('title', isset($blogpost) ? $blogpost->title : '') }}" required>

@error('title')
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('title') }}</strong>
</span>
@enderror
</div>

<div class='form-group pull-left col-6'>
<label for='sel1'>{{ trans('blogpost.select_category') }}:</label>
<div class='form-group col-6 mb-4'>
<label for='sel1'>{{ trans('blogpost.select_category') }}</label>
<select class='form-select' name='category_id' id='sel1'>

@foreach ($categories as $category)
Expand All @@ -40,10 +46,16 @@
</select>
</div>

<div class='form-group pull-left col-12'>
<label for='title'>{{ trans('blogpost.summary') }}:</label>
<input type='text' class='form-control' id='title' name='summary'
value="{{ old('summary', isset($blogpost) ? $blogpost->summary : '') }}"></br>
<div class='form-group col mb-4'>
<label for='title'>{{ trans('blogpost.summary') }}</label>
<textarea type='text' class='form-control @error('summary') is-invalid @enderror' id='summary' name='summary'>{{ old('summary', isset($blogpost) ? $blogpost->summary : '') }}</textarea>
</br>

@error('summary')
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('summary') }}</strong>
</span>
@enderror
</div>

</div>
Expand All @@ -57,7 +69,7 @@
@endif

<div class='form-group'>
<label for='file'>{{ trans('actions.upload_image') }}:</label>
<label for='file'>{{ trans('actions.upload_image') }}</label>
<input name='up_file' accept='image/*' id='input-2' type='file' class='file'
multiple='true'
data-drop-zone-enabled="{{ isset($blogpost) && $blogpost->hasImage() ? 'false' : 'true' }}"
Expand All @@ -68,7 +80,7 @@

<div class="col-12">
<div class='form-group pull-left col-12'>
<label for='text'>{{ trans('blogpost.post') }}:</label>
<label for='text'>{{ trans('blogpost.post') }}</label>
<text-editor id="texteditor" :name="'text'"
:data="'{{ remove_linebreaks(old('blogpost', isset($blogpost) ? $blogpost->text : '')) }}'"
:language="'{{ config('app.locale') }}'"
Expand Down
10 changes: 8 additions & 2 deletions app/View/users/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class='form-group pull-left col-xs-12 col-md-8'>
<div class='form-group'>
<label for='name'>{{ trans('user.create_name') }}:</label>
<input type='text' class='form-control' id='name' name='name'
<input type='text' class='form-control @error('name') is-invalid @enderror' id='name' name='name'
value="{{ old('name', isset($user) ? $user->name : '') }}" required autofocus>
</div>

Expand Down Expand Up @@ -61,8 +61,14 @@ class="form-control @error('password') is-invalid @enderror"

<div class='form-group'>
<label for='title'>{{ trans('user.create_email') }}:</label>
<input type='email' class='form-control' id='title' name='email'
<input type='email' class='form-control @error('email') is-invalid @enderror' id='email' name='email'
value="{{ old('email', isset($user) ? $user->email : '') }}" required>

@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
@enderror
</div>

<div class='form-group'>
Expand Down

0 comments on commit 3509098

Please sign in to comment.