(Update) Add Torrent List Setting

- Torrents Layout Setting
- You can now set your default torrents layout. Then when you visit
torrents icon in side nav it will automatically goto your preferred
torrents layout. You can find this new setting on your Account Settings
page.
- The default is the original Torrent List Layout.
- requires `php artisan migrate`
- - requires `php artisan clear:all`
This commit is contained in:
HDVinnie
2018-05-20 22:57:39 -04:00
parent 6c63272b1d
commit 04b8a3e1fd
5 changed files with 59 additions and 5 deletions
+2 -1
View File
@@ -104,7 +104,7 @@ class UserController extends Controller
$user = auth()->user();
// Avatar
$max_upload = config('image.max_upload_size');
if ($request->hasFile('image')) {
if ($request->hasFile('image') && $request->file('image')->getError() == 0) {
$image = $request->file('image');
if (in_array($image->getClientOriginalExtension(), ['jpg', 'JPG', 'jpeg', 'bmp', 'png', 'PNG', 'tiff', 'gif']) && preg_match('#image/*#', $image->getMimeType())) {
if ($max_upload >= $image->getSize()) {
@@ -183,6 +183,7 @@ class UserController extends Controller
$user->peer_hidden = $request->input('peer_hidden');
// Torrent Settings
$user->torrent_layout = (int)$request->input('torrent_layout');
$user->show_poster = $request->input('show_poster');
$user->ratings = $request->input('ratings');
@@ -0,0 +1,42 @@
<?php
/**
* NOTICE OF LICENSE
*
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
* @author HDVinnie
*/
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTorrentLayoutToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('torrent_layout')->default(0)->after('nav');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('torrent_layout');
});
}
}
+7 -1
View File
@@ -10,7 +10,13 @@
</a>
</li>
<li>
<a href="{{ route('torrents') }}">
@if(auth()->user()->torrent_layout == 1)
<a href="{{ route('grouping_categories') }}">
@elseif(auth()->user()->torrent_layout == 2)
<a href="{{ route('cards') }}">
@else
<a href="{{ route('torrents') }}">
@endif
<i class="livicon" data-name="medal" data-size="18" data-c="#00bc8c" data-hc="#00bc8c"
data-loop="true"></i>
<span class="menu-text">{{ trans('torrent.torrents') }}</span>
+7 -2
View File
@@ -124,6 +124,13 @@
<h2>Torrent Preferences</h2>
<hr>
<label for="torrent_layout" class="control-label">Default Torrent Layout?</label>
<select class="form-control" id="torrent_layout" name="torrent_layout">
<option @if($user->torrent_layout == 0) selected @endif value="0">Torrent List</option>
<option @if($user->torrent_layout == 1) selected @endif value="1">Torrent Grouping</option>
<option @if($user->torrent_layout == 2) selected @endif value="2">Torrent Cards</option>
</select>
<br>
<label for="poster" class="control-label">Show Posters On Torrent List View?</label>
<div class="radio-inline">
<label><input type="radio" name="show_poster" @if($user->show_poster == 1) checked @endif value="1">YES</label>
@@ -170,7 +177,6 @@
</h3>
<hr>
{{ Form::open(array('url' => '/{username}.{id}/settings/change_password','role' => 'form', 'class' => 'login-frm')) }}
{{ csrf_field() }}
<div class="form-group">
<label for="current_password">Current Password</label>
<input type="password" name="current_password" class="form-control" placeholder="Current Password">
@@ -207,7 +213,6 @@
</h3>
<hr>
{{ Form::open(array('url' => '/{username}.{id}/settings/change_pid','role' => 'form', 'class' => 'login-frm')) }}
{{ csrf_field() }}
<div class="form-group">
<label for="current_pid">Current pid</label>
<p class="form-control-static text-monospace current_pid">{{ $user->passkey }}</p>
+1 -1
View File
@@ -192,7 +192,7 @@ Route::group(['middleware' => 'language'], function () {
Route::post('/upload', 'TorrentController@upload')->name('upload');
Route::get('/download_check/{slug}.{id}', 'TorrentController@downloadCheck')->name('download_check');
Route::get('/download/{slug}.{id}', 'TorrentController@download')->name('download');
Route::get('/torrents/cards', 'TorrentController@cards')->name('cards');
Route::get('/torrents/cards', 'TorrentController@cardsLayout')->name('cards');
Route::post('/torrents/delete', 'TorrentController@deleteTorrent')->name('delete');
Route::get('/torrents/{slug}.{id}/edit', 'TorrentController@editForm')->name('edit_form');
Route::post('/torrents/{slug}.{id}/edit', 'TorrentController@edit')->name('edit');