(Update) Categories System

- Make UNIT3D more general friendly. On top of the icons from previous
commit there is now option to select if there will be meta for the
category or not. Movie and TV cats should have meta enabled. Music,
Apps and whatnot should not. If meta is not enabled for said category
then the meta block is hidden for said torrent or request on its
details page.
This commit is contained in:
HDVinnie
2017-12-29 22:39:26 -05:00
parent 3901ec875d
commit a3e5a89390
9 changed files with 29 additions and 5 deletions
+2 -1
View File
@@ -25,7 +25,8 @@ class Category extends Model
public $rules = [
'name' => 'required|unique:categories',
'slug' => 'required|unique:categories',
'icon' => 'required'
'icon' => 'required',
'meta' => 'required'
];
/**
@@ -48,6 +48,7 @@ class CategoryController extends Controller
$category->name = Request::get('name');
$category->slug = str_slug($category->name);
$category->icon = Request::get('icon');
$category->meta = Request::get('meta');
$v = Validator::make($category->toArray(), $category->rules);
if ($v->fails()) {
Toastr::error('Something Went Wrong!', 'Error', ['options']);
@@ -71,6 +72,7 @@ class CategoryController extends Controller
$category->name = Request::get('name');
$category->slug = str_slug($category->name);
$category->icon = Request::get('icon');
$category->meta = Request::get('meta');
$v = Validator::make($category->toArray(), $category->rules);
if ($v->fails()) {
Toastr::error('Something Went Wrong!', 'Error', ['options']);
@@ -28,6 +28,7 @@ class CreateCategoriesTable extends Migration
$table->string('name');
$table->string('slug');
$table->string('icon');
$table->string('meta')->default(0);
$table->integer('num_torrent')->default(0);
});
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+9 -1
View File
@@ -30,7 +30,15 @@
<label for="name">Icon (FontAwesome)</label>
<input type="text" class="form-control" name="icon" placeholder="Example: fa fa-rocket">
</div>
<label for="sidenav" class="control-label">Has Meta Data? (Movie/TV)</label>
<div class="radio-inline">
<label><input type="radio" name="meta" checked value="1">Yes</label>
</div>
<div class="radio-inline">
<label><input type="radio" name="meta" value="0">No</label>
</div>
<br>
<br>
<button type="submit" class="btn btn-default">{{ trans('common.add') }}</button>
{{ Form::close() }}
</div>
@@ -30,7 +30,15 @@
<label for="name">Icon (FontAwesome)</label>
<input type="text" class="form-control" name="icon" value="{{ $category->icon }}">
</div>
<label for="sidenav" class="control-label">Has Meta Data? (Movie/TV)</label>
<div class="radio-inline">
<label><input type="radio" name="meta" @if($category->meta == 1) checked @endif value="1">Yes</label>
</div>
<div class="radio-inline">
<label><input type="radio" name="meta" @if($category->meta == 0) checked @endif value="0">No</label>
</div>
<br>
<br>
<button type="submit" class="btn btn-default">{{ trans('common.submit') }}</button>
{{ Form::close() }}
</div>
@@ -23,6 +23,7 @@
<tr>
<th>Name</th>
<th>Icon</th>
<th>Meta?</th>
<th>Action</th>
</tr>
</thead>
@@ -31,6 +32,7 @@
<tr>
<td><a href="{{ route('staff_category_edit', array('slug' => $c->slug, 'id' => $c->id)) }}">{{ $c->name }}</a></td>
<td><i class="{{ $c->icon }}" aria-hidden="true"></i></td>
<td>@if($c->meta == 1) YES @else NO @endif</td>
<td>
<a href="{{ route('staff_category_edit', array('slug' => $c->slug, 'id' => $c->id)) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('staff_category_delete', array('slug' => $c->slug, 'id' => $c->id)) }}" class="btn btn-danger">Delete</a>
+2 -1
View File
@@ -64,6 +64,7 @@
</div>
</div>
</div>
@if($request->category->meta == 1)
<div class="movie-wrapper">
<div class="movie-backdrop" style="background-image: url({{ $movie->backdrop }});">
<div class="tags">
@@ -139,7 +140,7 @@
</div>
</div>
</div>
@endif
<div class="table-responsive">
<table class="table table-condensed table-bordered table-striped">
<tbody>
+2 -1
View File
@@ -29,6 +29,7 @@
<div class="torrent box container">
<div style="line-height: 15px;height:45px;width:100%;background: repeating-linear-gradient( 45deg,#D13A3A,#D13A3A 10px,#DF4B4B 10px,#DF4B4B 20px);border:solid 1px #B22929;-webkit-box-shadow: 0px 0px 6px #B22929;margin-bottom:-0px;margin-top:0px;font-family:Verdana;font-size:large;text-align:center;color:white">
<br>Please remember to say <b>thanks</b> and <b>seed</b> for as long as you can!</div>
@if($torrent->category->meta == 1)
<div class="movie-wrapper">
<div class="movie-backdrop" style="background-image: url({{ $movie->backdrop }});">
<div class="tags">
@@ -119,7 +120,7 @@
</div>
</div>
</div>
@endif
<!-- Info -->
<div class="table-responsive">
<table class="table table-condensed table-bordered table-striped">