Skip to content

Commit

Permalink
Merge pull request #11795 from nanaya/team-disband-settings
Browse files Browse the repository at this point in the history
Move team disband button to settings page
  • Loading branch information
notbakaneko authored Jan 23, 2025
2 parents 89b2f71 + 02bd1e7 commit bf617d3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
5 changes: 5 additions & 0 deletions resources/css/bem/team-action-button.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
background: var(--bg-hover);
}

&--disabled {
pointer-events: none;
opacity: 0.7;
}

&--part {
--bg: hsl(var(--hsl-red-3));
--bg-hover: hsl(var(--hsl-red-2));
Expand Down
5 changes: 5 additions & 0 deletions resources/css/bem/team-settings.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
display: grid;
gap: 5px;

&__buttons {
display: flex;
gap: 10px;
}

&__description-preview {
--padding: 10px;
padding: var(--padding) 0;
Expand Down
14 changes: 11 additions & 3 deletions resources/views/teams/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,23 @@ class="input-text__bbcode-textarea js-post-preview--auto js-bbcode-body"
<div class="team-settings">
<div class="team-settings__item team-settings__item--buttons">
<div>
<a
class="btn-osu-big btn-osu-big--danger btn-osu-big--rounded-thin"
data-turbo-confirm="{{ osu_trans('common.confirmation') }}"
data-turbo-method="DELETE"
href="{{ route('teams.destroy', $team) }}"
>
{{ osu_trans('teams.show.bar.destroy') }}
</a>
</div>

<div class="team-settings__buttons">
<a
class="btn-osu-big btn-osu-big--rounded-thin"
href="{{ route('teams.show', ['team' => $team]) }}"
>
{{ osu_trans('common.buttons.cancel') }}
</a>
</div>

<div>
<button class="btn-osu-big btn-osu-big--rounded-thin">
{{ osu_trans('common.buttons.save') }}
</button>
Expand Down
50 changes: 19 additions & 31 deletions resources/views/teams/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
$teamMembers['member'] ??= [];
$teamMembers['leader'] ??= $toJson([$team->members()->make(['user_id' => $team->leader_id])->userOrDeleted()]);
$headerUrl = $team->header()->url();
$buttons = new Ds\Set();
if (priv_check('TeamPart', $team)->can()) {
$buttons->add('part');
}
if (priv_check('TeamUpdate', $team)->can()) {
$buttons->add('destroy');
}
@endphp

@extends('master', [
Expand Down Expand Up @@ -77,31 +69,27 @@ class="btn-circle btn-circle--page-toggle"
</div>
</div>
</div>
@if (!$buttons->isEmpty())
@if (Auth::user()?->team?->getKey() === $team->getKey())
<div class="profile-detail-bar profile-detail-bar--team">
@if ($buttons->contains('destroy'))
<form
action="{{ route('teams.destroy', $team) }}"
data-turbo-confirm="{{ osu_trans('common.confirmation') }}"
method="POST"
>
<input type="hidden" name="_method" value="DELETE">
<button class="team-action-button team-action-button--part">
{{ osu_trans('teams.show.bar.destroy') }}
</button>
</form>
@endif
@if ($buttons->contains('part'))
<form
action="{{ route('teams.part', ['team' => $team]) }}"
data-turbo-confirm="{{ osu_trans('common.confirmation') }}"
method="POST"
@php
$partPriv = priv_check('TeamPart', $team);
$canPart = $partPriv->can();
@endphp
<form
action="{{ route('teams.part', ['team' => $team]) }}"
data-turbo-confirm="{{ osu_trans('common.confirmation') }}"
title="{{ $partPriv->message() }}"
method="POST"
>
<button
class="{{ class_with_modifiers('team-action-button', 'part', ['disabled' => !$canPart]) }}"
@if (!$canPart)
disabled
@endif
>
<button class="team-action-button team-action-button--part">
{{ osu_trans('teams.show.bar.part') }}
</button>
</form>
@endif
{{ osu_trans('teams.show.bar.part') }}
</button>
</form>
</div>
@endif
<div class="user-profile-pages user-profile-pages--no-tabs">
Expand Down

0 comments on commit bf617d3

Please sign in to comment.