Skip to content

Commit

Permalink
Merge pull request #10351 from nanaya/feature-vote-confirm
Browse files Browse the repository at this point in the history
 Add confirmation when voting for feature
  • Loading branch information
notbakaneko authored Jul 7, 2023
2 parents d4e54b9 + 7699d8b commit 91e35d4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions resources/views/forum/topics/_feature_vote.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
See the LICENCE file in the repository root for full licence text.
--}}
@php
$currentUser = Auth::user();
@endphp
<div class="forum-topic-feature-vote">
<div class="forum-topic-feature-vote__info">
{!! osu_trans('forum.topics.show.feature_vote.info._', [
Expand Down Expand Up @@ -31,15 +34,16 @@ class="
]) }}
</div>

@if (Auth::check())
@if ($currentUser !== null)
<div class="forum-topic-feature-vote__button">
<button
class="btn-osu-big btn-osu-big--forum-primary"
data-confirm="{{ osu_trans('common.confirmation') }}"
data-url="{{ route('forum.topics.vote-feature', $topic->getKey()) }}"
data-method="POST"
data-remote=1
data-disable-with="{{ osu_trans('common.buttons.saving') }}"
@if (Auth::user()->osu_featurevotes < App\Models\Forum\FeatureVote::COST)
@if ($currentUser->osu_featurevotes < App\Models\Forum\FeatureVote::COST)
disabled
@endif
>
Expand All @@ -49,7 +53,7 @@ class="btn-osu-big btn-osu-big--forum-primary"

<div class="forum-topic-feature-vote__remaining">
{!! osu_trans('forum.topics.show.feature_vote.user.current', [
'votes' => '<strong>'.osu_trans_choice('forum.topics.show.feature_vote.user.count', Auth::user()->osu_featurevotes).'</strong>',
'votes' => '<strong>'.osu_trans_choice('forum.topics.show.feature_vote.user.count', $currentUser->osu_featurevotes).'</strong>',
]) !!}
</div>
@endif
Expand Down

0 comments on commit 91e35d4

Please sign in to comment.