Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Add) Perks to the Group requirements page #3686

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/Controllers/StatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function groupsRequirements(): \Illuminate\Contracts\View\Factory|\Illumi
'user_avg_seedtime' => $user_avg_seedtime,
'user_account_age' => $user_account_age,
'user_seed_size' => $user_seed_size,
'groups' => Group::orderBy('position')->where('autogroup', 1)->get(),
'groups' => Group::orderBy('position')->where('autogroup', '=', 1)->get(),
]);
}

Expand Down
3 changes: 3 additions & 0 deletions app/Http/Requests/Staff/StoreGroupRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function rules(): array
'nullable',
'integer',
],
'description' => [
'nullable',
],
'color' => [
'required',
],
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Requests/Staff/UpdateGroupRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public function rules(Request $request): array
'nullable',
'integer',
],
'description' => [
'nullable',
],
'color' => [
'required',
],
Expand Down
1 change: 1 addition & 0 deletions app/Models/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @property int $position
* @property int $level
* @property int|null $download_slots
* @property string $description
* @property string $color
* @property string $icon
* @property string $effect
Expand Down
28 changes: 28 additions & 0 deletions database/migrations/2024_03_21_145139_add_group_description.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('groups', function (Blueprint $table): void {
$table->string('description')->nullable()->after('download_slots');
});
}
};
12 changes: 12 additions & 0 deletions resources/views/Staff/group/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
{{ __('common.name') }}
</label>
</p>
<p class="form__group">
<input
id="description"
class="form__text"
type="text"
name="description"
placeholder=" "
/>
<label class="form__label form__label--floating" for="description">
{{ __('common.description') }}
</label>
</p>
<p class="form__group">
<input
id="position"
Expand Down
13 changes: 13 additions & 0 deletions resources/views/Staff/group/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ class="form__text"
{{ __('common.name') }}
</label>
</p>
<p class="form__group">
<input
id="description"
class="form__text"
type="text"
name="description"
placeholder=" "
value="{{ $group->description }}"
/>
<label class="form__label form__label--floating" for="description">
{{ __('common.description') }}
</label>
</p>
<p class="form__group">
<input
id="position"
Expand Down
84 changes: 83 additions & 1 deletion resources/views/stats/groups/groups-requirements.blade.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<tr>
<th>{{ __('common.group') }}</th>
<th>Requirement</th>
<th>Perks</th>
</tr>
</thead>
<tbody>
Expand All @@ -41,7 +42,10 @@
<td style="min-width: 20%">
<a
href="{{ route('group', ['id' => $group->id]) }}"
style="color: {{ $group->color }}"
style="
color: {{ $group->color }};
background-image: {{ $group->effect }};
"
>
<i class="{{ $group->icon }}"></i>
{{ $group->name }}
Expand Down Expand Up @@ -156,8 +160,86 @@ class="{{ config('other.font-awesome') }} fa-x text-red"
</tr>
</tbody>
</table>
@else
{{ $group->description ?? '' }}
@endif
</td>
<td>
<table class="data-table">
<tbody>
<tr>
<td>
<i
class="{{ config('other.font-awesome') }} fa-arrow-down-short-wide text-blue"
></i>
DL Slots: {{ $group->download_slots ?? '∞' }}
</td>
</tr>
@if ($group->can_upload)
<tr>
<td>
<i
class="{{ config('other.font-awesome') }} fa-upload text-success"
></i>
{{ __('common.upload') }}
{{ __('torrent.torrents') }}
</td>
</tr>
@endif

@if ($group->is_freeleech)
<tr>
<td>
<i
class="{{ config('other.font-awesome') }} fa-star text-gold"
></i>
{{ __('torrent.freeleech') }}
</td>
</tr>
@endif

@if ($group->is_double_upload)
<tr>
<td>
<i
class="fas fa-chevron-double-up torrent-icons__double-upload"
></i>
{{ __('torrent.double-upload') }}
</td>
</tr>
@endif

@if ($group->is_refundable)
<tr>
<td>
<i class="fas fa-percentage"></i>
{{ __('torrent.refundable') }}
</td>
</tr>
@endif

@if ($group->is_immune)
<tr>
<td>
<i
class="{{ config('other.font-awesome') }} fa-syringe"
></i>
Immune to automated HnR warnings
</td>
</tr>
@endif

@if ($group->is_trusted)
<tr>
<td>
<i class="fas fa-tasks"></i>
{{ __('staff.torrent-moderation') }} bypass
</td>
</tr>
@endif
</tbody>
</table>
</td>
</tr>
@endforeach
</tbody>
Expand Down