forked from mirror/pixelfed
Update admin page edit view
This commit is contained in:
parent
bb207a42bd
commit
ef07e31d9a
1 changed files with 25 additions and 7 deletions
|
@ -14,7 +14,7 @@
|
||||||
<input class="form-control form-control-lg" id="title" name="title" placeholder="Title">
|
<input class="form-control form-control-lg" id="title" name="title" placeholder="Title">
|
||||||
<p class="small text-muted">
|
<p class="small text-muted">
|
||||||
Page URL: <span class="page-url font-weight-bold">{{$page->url()}}</span>
|
Page URL: <span class="page-url font-weight-bold">{{$page->url()}}</span>
|
||||||
<span class="pl-1"><a href="#" class="font-weight-bold">Edit</a></span>
|
{{-- <span class="pl-1"><a href="#" class="font-weight-bold">Edit</a></span> --}}
|
||||||
</p>
|
</p>
|
||||||
<div id="editor" style="height: 400px">
|
<div id="editor" style="height: 400px">
|
||||||
{!!$page->content!!}
|
{!!$page->content!!}
|
||||||
|
@ -25,10 +25,11 @@
|
||||||
<input type="checkbox" class="custom-control-input" id="activeSwitch" {{$page->active?'checked="true"':''}}>
|
<input type="checkbox" class="custom-control-input" id="activeSwitch" {{$page->active?'checked="true"':''}}>
|
||||||
<label class="custom-control-label font-weight-bold" for="activeSwitch">Active</label>
|
<label class="custom-control-label font-weight-bold" for="activeSwitch">Active</label>
|
||||||
</div>
|
</div>
|
||||||
<a class="btn btn-light font-weight-bold py-0" href="#">Set Expire Date</a>
|
{{-- <a class="btn btn-light font-weight-bold py-0" href="#">Set Expire Date</a> --}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a class="btn btn-light font-weight-bold py-0" href="#">Preview</a>
|
{{-- <a class="btn btn-light font-weight-bold py-0" href="#">Preview</a> --}}
|
||||||
|
<a class="btn btn-outline-danger font-weight-bold py-0 btn-delete" href="#">Delete</a>
|
||||||
<a class="btn btn-primary font-weight-bold py-0 btn-save" href="#">Save</a>
|
<a class="btn btn-primary font-weight-bold py-0 btn-save" href="#">Save</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('styles')
|
@push('styles')
|
||||||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.6/quill.snow.min.css" integrity="sha256-qc/vMbPSg7/JfxMwKeMv3wlx7ojG33FXfYfO0UJIsc0=" crossorigin="anonymous" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.ql-container {
|
.ql-container {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -51,16 +52,18 @@
|
||||||
</style>
|
</style>
|
||||||
@endpush
|
@endpush
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<!-- Include the Quill library -->
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.6/quill.min.js" integrity="sha256-3oYBiGm16EW9wQH8G1VhGh43XgivbO5KaB10RhA9phE=" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
|
||||||
|
|
||||||
<!-- Initialize Quill editor -->
|
|
||||||
<script>
|
<script>
|
||||||
window.editor = new Quill('#editor', {
|
window.editor = new Quill('#editor', {
|
||||||
theme: 'snow'
|
theme: 'snow'
|
||||||
});
|
});
|
||||||
$('.btn-save').on('click', function(e) {
|
$('.btn-save').on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
let confirm = window.confirm('Are you sure you want to save this page?');
|
||||||
|
if(confirm !== true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let html = editor.container.firstChild.innerHTML;
|
let html = editor.container.firstChild.innerHTML;
|
||||||
let title = $('#title').val();
|
let title = $('#title').val();
|
||||||
let active = $('#activeSwitch')[0].checked;
|
let active = $('#activeSwitch')[0].checked;
|
||||||
|
@ -76,6 +79,21 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.btn-delete').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
let confirm = window.confirm('Are you sure you want to delete this page?');
|
||||||
|
if(confirm == true) {
|
||||||
|
axios.post('/i/admin/settings/pages/delete', {
|
||||||
|
id: '{{$page->id}}'
|
||||||
|
}).then(res => {
|
||||||
|
window.location.href = '/i/admin/settings/pages';
|
||||||
|
}).catch(err => {
|
||||||
|
swal('Error', 'An error occured!', 'error');
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#title').on('change input', function(e) {
|
$('#title').on('change input', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let title = this.value.split(' ').join('-').toLowerCase();
|
let title = this.value.split(' ').join('-').toLowerCase();
|
||||||
|
|
Loading…
Reference in a new issue