Skip to content

Commit 534533d

Browse files
Post saving improvements
1 parent 1e02477 commit 534533d

File tree

8 files changed

+58
-39
lines changed

8 files changed

+58
-39
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"lodash": "^4.17.21",
2727
"perfect-scrollbar": "^1.5.1",
2828
"resolve-url-loader": "^3.1.3",
29-
"sass": "^1.34.1",
29+
"sass": "~1.32.13",
3030
"sass-loader": "^10.2.0",
3131
"vue-template-compiler": "^2.6.13"
3232
},

public/js/admin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/admin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ bsCustomFileInput.init();
44
require('./scripts/tinymce');
55
require('./scripts/sidebar');
66
require('./scripts/proper-url');
7+
require('./scripts/post-date');

resources/js/scripts/post-date.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const checkbox = document.querySelector('#is_visible');
2+
const inputs = document.querySelector('#release-inputs');
3+
4+
function changeInputs(value){
5+
if (value)
6+
inputs.classList.add('d-none');
7+
else inputs.classList.remove('d-none');
8+
}
9+
10+
if (checkbox && inputs){
11+
changeInputs(checkbox.checked);
12+
13+
checkbox.addEventListener('change', function(e){
14+
changeInputs(e.target.checked);
15+
});
16+
}

resources/views/admin/posts/index.blade.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
<thead class="thead-light">
2525
<tr>
2626
<th scope="col">{{ __('ID') }}</th>
27-
<th scope="col">{{ __('Categories') }}</th>
2827
<th scope="col">{{ __('thumbnail') }}</th>
2928
<th scope="col">{{ __('title') }}</th>
3029
<th scope="col">{{ __('description') }}</th>
30+
<th scope="col">{{ __('Categories') }}</th>
3131
<th scope="col">{{ __('Author') }}</th>
3232
<th scope="col"></th>
3333
</tr>
@@ -37,6 +37,15 @@
3737
@php $content = $post->content()->first(); @endphp
3838
<tr>
3939
<th scope="row">{{ $post->id }}</th>
40+
<td>
41+
@if(!empty($post->thumbnail_path))
42+
<img class="img-fluid" src="{{ $post->thumbnail }}" alt="{{ $content->title ?? '' }}" width="144" height="144">
43+
@else
44+
{{ __('No image') }}
45+
@endif
46+
</td>
47+
<td>{{ $content->title ?? '' }}</td>
48+
<td>{!! $content->description ?? '' !!}</td>
4049
<td>
4150
<ul class="list-unstyled">
4251
@foreach($post->categories as $category)
@@ -49,15 +58,6 @@
4958
@endforeach
5059
<ul>
5160
</td>
52-
<td>
53-
@if(!empty($post->thumbnail_path))
54-
<img class="img-fluid" src="{{ $post->thumbnail }}" alt="{{ $content->title ?? '' }}" width="144" height="144">
55-
@else
56-
{{ __('No image') }}
57-
@endif
58-
</td>
59-
<td>{{ $content->title ?? '' }}</td>
60-
<td>{!! $content->description ?? '' !!}</td>
6161
<td>{{ $post->author->full_name }}</td>
6262
<td>
6363
<div class="dropdown text-right">

resources/views/admin/posts/save.blade.php

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -83,29 +83,6 @@
8383
@endempty
8484
</div>
8585

86-
<div class="form-group">
87-
<div class="form-row">
88-
<div class="col-md-8">
89-
<label for="publish_at_date">{{ __('Publish At Date') }}</label>
90-
<input type="date" id="publish_at_date" name="publish_at_date" class="form-control">{{ !empty($post->publish_at) ? $post->publish_at->format('Y-m-d') : '' }}
91-
@error('publish_at_date')
92-
<span class="form-text text-danger" role="alert">
93-
<strong>{{ $message }}</strong>
94-
</span>
95-
@enderror
96-
</div>
97-
<div class="col-md-4">
98-
<label for="publish_at_time">{{ __('Publish At Time') }}</label>
99-
<input type="time" id="publish_at_time" name="publish_at_time" class="form-control">{{ !empty($post->publish_at) ? $post->publish_at->format('H:i') : '' }}
100-
@error('publish_at_time')
101-
<span class="form-text text-danger" role="alert">
102-
<strong>{{ $message }}</strong>
103-
</span>
104-
@enderror
105-
</div>
106-
</div>
107-
</div>
108-
10986
<div class="form-group">
11087
<label for="tags">{{ __('Tags') }}</label>
11188
<input type="text" id="tags" name="tags" class="form-control @error('tags') is-invalid @enderror" value="{{ $post->tags ?? old('tags') }}">
@@ -123,6 +100,31 @@
123100
</div>
124101
</div>
125102

103+
<div id="release-inputs">
104+
<div class="form-group">
105+
<div class="form-row">
106+
<div class="col-md-8">
107+
<label for="publish_at_date">{{ __('Publish At Date') }}</label>
108+
<input type="date" id="publish_at_date" name="publish_at_date" class="form-control">{{ !empty($post->publish_at) ? $post->publish_at->format('Y-m-d') : '' }}
109+
@error('publish_at_date')
110+
<span class="form-text text-danger" role="alert">
111+
<strong>{{ $message }}</strong>
112+
</span>
113+
@enderror
114+
</div>
115+
<div class="col-md-4">
116+
<label for="publish_at_time">{{ __('Publish At Time') }}</label>
117+
<input type="time" id="publish_at_time" name="publish_at_time" class="form-control">{{ !empty($post->publish_at) ? $post->publish_at->format('H:i') : '' }}
118+
@error('publish_at_time')
119+
<span class="form-text text-danger" role="alert">
120+
<strong>{{ $message }}</strong>
121+
</span>
122+
@enderror
123+
</div>
124+
</div>
125+
</div>
126+
</div>
127+
126128
<div class="form-group">
127129
<button type="submit" class="btn btn-primary">{{ $prefix }}</button>
128130
</div>

0 commit comments

Comments
 (0)