diff --git a/app/Controllers/Settings/AccountController.php b/app/Controllers/Settings/AccountController.php index 104b248..5f7758a 100644 --- a/app/Controllers/Settings/AccountController.php +++ b/app/Controllers/Settings/AccountController.php @@ -245,29 +245,26 @@ class AccountController extends Controller ]; if (session_check() && $rank && $mode) { - $redirect = route('settings.account.ranks'); - // Check if user has this rank if (!CurrentSession::$user->hasRanks([$rank])) { - $message = "You aren't a part of this rank!"; - return view('global/information', compact('redirect', 'message')); + return $this->json(['error' => "You aren't a part of this rank!"]); } - if ($mode == 'remove') { - if (in_array($rank, $locked)) { - $message = "You aren't allowed to remove this rank from your account!"; - return view('global/information', compact('redirect', 'message')); - } + switch ($mode) { + case 'remove': + if (in_array($rank, $locked)) { + return $this->json(['error' => "You aren't allowed to remove this rank from your account!"]); + } - CurrentSession::$user->removeRanks([$rank]); + CurrentSession::$user->removeRanks([$rank]); + break; - $message = "Removed the rank from your account!"; - return view('global/information', compact('redirect', 'message')); + case 'main': + CurrentSession::$user->setMainRank($rank); + break; } - CurrentSession::$user->setMainRank($rank); - - return redirect($redirect); + return $this->json(['error' => null]); } return view('settings/account/ranks', compact('locked')); @@ -287,21 +284,17 @@ class AccountController extends Controller $maxLength = config('user.page_max'); if (session_check() && $userpage) { - $redirect = route('settings.account.userpage'); - if (strlen($userpage) > $maxLength) { - $message = 'Your userpage is too long, shorten it a little!'; - } else { - DB::table('users') - ->where('user_id', CurrentSession::$user->id) - ->update([ - 'user_page' => $userpage, - ]); - - $message = 'Updated your userpage!'; + return $this->json(['error' => 'Your userpage is too long, shorten it a little!']); } - return view('global/information', compact('message', 'redirect')); + DB::table('users') + ->where('user_id', CurrentSession::$user->id) + ->update([ + 'user_page' => $userpage, + ]); + + return $this->json(['error' => null]); } return view('settings/account/userpage', compact('maxLength')); @@ -322,21 +315,17 @@ class AccountController extends Controller $maxLength = config('user.signature_max'); if (session_check() && $signature) { - $redirect = route('settings.account.signature'); - if (strlen($signature) > $maxLength) { - $message = 'Your signature is too long, shorten it a little!'; - } else { - DB::table('users') - ->where('user_id', CurrentSession::$user->id) - ->update([ - 'user_signature' => $signature, - ]); - - $message = 'Updated your signature!'; + return $this->json(['error' => 'Your signature is too long, shorten it a little!']); } - return view('global/information', compact('message', 'redirect')); + DB::table('users') + ->where('user_id', CurrentSession::$user->id) + ->update([ + 'user_signature' => $signature, + ]); + + return $this->json(['error' => null]); } return view('settings/account/signature', compact('maxLength')); diff --git a/resources/assets/less/yuuno/bem/friend-box.less b/resources/assets/less/yuuno/bem/friend-box.less index 0104534..4235c11 100644 --- a/resources/assets/less/yuuno/bem/friend-box.less +++ b/resources/assets/less/yuuno/bem/friend-box.less @@ -13,11 +13,14 @@ &__container { display: block; + width: 100%; + height: 100%; text-decoration: none !important; color: #000; margin: 5px auto; background-color: transparent; border: 0; + cursor: pointer; &:active { color: inherit; @@ -61,6 +64,7 @@ background-color: transparent; border: 0; transition: color .2s; + cursor: pointer; &:hover { color: #333; diff --git a/resources/views/yuuno/settings/account/_preview.twig b/resources/views/yuuno/settings/account/_preview.twig index 8d7bd8d..060c039 100644 --- a/resources/views/yuuno/settings/account/_preview.twig +++ b/resources/views/yuuno/settings/account/_preview.twig @@ -5,7 +5,7 @@ preview = document.getElementById("settingsPreview"); parser.SetUrl("{{ route('helper.bbcode.parse') }}"); - parser.ContentType("application/x-www-form-urlencoded"); + parser.Form(); function settingsPreview() { var text = form.value; diff --git a/resources/views/yuuno/settings/account/details.twig b/resources/views/yuuno/settings/account/details.twig index b6c555f..0aaa365 100644 --- a/resources/views/yuuno/settings/account/details.twig +++ b/resources/views/yuuno/settings/account/details.twig @@ -8,6 +8,7 @@ {% block settingsContent %}
{% endblock %} diff --git a/resources/views/yuuno/settings/account/profile.twig b/resources/views/yuuno/settings/account/profile.twig index 7fe8096..717eb9e 100644 --- a/resources/views/yuuno/settings/account/profile.twig +++ b/resources/views/yuuno/settings/account/profile.twig @@ -91,6 +91,7 @@ {% block settingsContent %} {% endblock %} diff --git a/resources/views/yuuno/settings/account/ranks.twig b/resources/views/yuuno/settings/account/ranks.twig index 79f79ad..5dea897 100644 --- a/resources/views/yuuno/settings/account/ranks.twig +++ b/resources/views/yuuno/settings/account/ranks.twig @@ -6,19 +6,100 @@Manage what ranks you're in and what is set as your main rank. Your main rank is highlighted. You get the permissions of all of the ranks you're in combined.
{% endblock %} +{% block js %} + +{% endblock %} + {% block settingsContent %}