mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Add admin discover views
This commit is contained in:
parent
a49500fcbd
commit
104aa7e0a4
2 changed files with 127 additions and 0 deletions
77
resources/views/admin/discover/create-category.blade.php
Normal file
77
resources/views/admin/discover/create-category.blade.php
Normal file
|
@ -0,0 +1,77 @@
|
|||
@extends('admin.partial.template-full')
|
||||
|
||||
@section('section')
|
||||
<div class="title">
|
||||
<h3 class="font-weight-bold d-inline-block">Discover</h3>
|
||||
<p class="lead">Create Category</p>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form class="px-md-5 cc-form" method="post">
|
||||
<div class="form-group row">
|
||||
<label for="categoryName" class="col-sm-2 col-form-label font-weight-bold">Name</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="categoryName" placeholder="Nature" autocomplete="off">
|
||||
<p class="form-text small font-weight-bold text-muted">Slug: /discover/c/nature</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="categoryName" class="col-sm-2 col-form-label font-weight-bold">Media ID</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="categoryMedia" placeholder="1" autocomplete="off">
|
||||
<p class="form-text small font-weight-bold text-muted">Media ID is used for category thumbnail image</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="categoryActive" class="col-sm-2 col-form-label font-weight-bold">Active</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="custom-control custom-switch pt-2">
|
||||
<input type="checkbox" class="custom-control-input" id="categoryActive">
|
||||
<label class="custom-control-label" for="categoryActive"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label font-weight-bold">Rules</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="custom-control custom-switch pt-2">
|
||||
<input type="checkbox" class="custom-control-input" id="categoryNsfw">
|
||||
<label class="custom-control-label" for="categoryNsfw">Allow NSFW</label>
|
||||
</div>
|
||||
<div class="custom-control custom-switch pt-2">
|
||||
<input type="checkbox" class="custom-control-input" id="categoryNsfw">
|
||||
<label class="custom-control-label" for="categoryType">Allow Photos + Video</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="text-right">
|
||||
<button type="submit" class="btn btn-primary btn-sm py-1 font-weight-bold">Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.cc-form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
let data = {
|
||||
'name': document.getElementById('categoryName').value,
|
||||
'media': document.getElementById('categoryMedia').value,
|
||||
'active': document.getElementById('categoryActive').checked
|
||||
};
|
||||
|
||||
axios.post('{{request()->url()}}', data)
|
||||
.then(res => {
|
||||
window.location.href = '{{route('admin.discover')}}';
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
50
resources/views/admin/discover/home.blade.php
Normal file
50
resources/views/admin/discover/home.blade.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
@extends('admin.partial.template-full')
|
||||
|
||||
@section('section')
|
||||
<div class="title">
|
||||
<h3 class="font-weight-bold d-inline-block">Discover</h3>
|
||||
<span class="float-right">
|
||||
<a class="btn btn-outline-primary btn-sm py-1" href="{{route('admin.discover.create-category')}}">Create</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<ul class="list-group">
|
||||
@foreach($categories as $category)
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<a class="font-weight-lighter small mr-3" href="/i/admin/media/show/{{$category->id}}">{{$category->id}}</a>
|
||||
<a href="{{$category->url()}}">
|
||||
<img class="" src="{{$category->thumb()}}" width="60px" height="60px">
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<p class="lead mb-0">{{$category->slug}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="d-inline-block text-center px-3">
|
||||
<p class="h3 mb-0 font-weight-lighter">{{$category->hashtags()->count()}}</p>
|
||||
<p class="mb-0 small font-weight-light text-muted">Hashtags</p>
|
||||
</div>
|
||||
<div class="d-inline-block text-center px-3">
|
||||
<p class="h3 mb-0 font-weight-lighter">{{$category->posts()->count()}}</p>
|
||||
<p class="mb-0 small font-weight-light text-muted">Posts</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@if($category->active)
|
||||
<span class="badge badge-success mr-3">Active</span>
|
||||
@endif
|
||||
<a class="btn btn-outline-secondary btn-sm py-0 mr-3" href="{{$category->editUrl()}}">Edit</a>
|
||||
<a class="btn btn-outline-secondary btn-sm py-0" href="{{$category->url()}}">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-center">
|
||||
{{$categories->links()}}
|
||||
</div>
|
||||
@endsection
|
Loading…
Reference in a new issue