mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 09:17:03 +00:00
Merge pull request #203 from dansup/frontend-ui-refactor
Update ProfileController
This commit is contained in:
commit
d0d8da1192
2 changed files with 12 additions and 4 deletions
|
@ -61,15 +61,23 @@ class ProfileController extends Controller
|
||||||
public function followers(Request $request, $username)
|
public function followers(Request $request, $username)
|
||||||
{
|
{
|
||||||
$profile = Profile::whereUsername($username)->firstOrFail();
|
$profile = Profile::whereUsername($username)->firstOrFail();
|
||||||
|
// TODO: fix $profile/$user mismatch in profile & follower templates
|
||||||
|
$user = $profile;
|
||||||
|
$owner = Auth::check() && Auth::id() === $user->user_id;
|
||||||
|
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
|
||||||
$followers = $profile->followers()->orderBy('created_at','desc')->simplePaginate(12);
|
$followers = $profile->followers()->orderBy('created_at','desc')->simplePaginate(12);
|
||||||
return view('profile.followers', compact('profile', 'followers'));
|
return view('profile.followers', compact('user', 'profile', 'followers', 'owner', 'is_following'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function following(Request $request, $username)
|
public function following(Request $request, $username)
|
||||||
{
|
{
|
||||||
$profile = Profile::whereUsername($username)->firstOrFail();
|
$profile = Profile::whereUsername($username)->firstOrFail();
|
||||||
|
// TODO: fix $profile/$user mismatch in profile & follower templates
|
||||||
|
$user = $profile;
|
||||||
|
$owner = Auth::check() && Auth::id() === $user->user_id;
|
||||||
|
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
|
||||||
$following = $profile->following()->orderBy('created_at','desc')->simplePaginate(12);
|
$following = $profile->following()->orderBy('created_at','desc')->simplePaginate(12);
|
||||||
return view('profile.following', compact('profile', 'following'));
|
return view('profile.following', compact('user', 'profile', 'following', 'owner', 'is_following'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function savedBookmarks(Request $request, $username)
|
public function savedBookmarks(Request $request, $username)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<span class="h5 pl-2 b-0">
|
<span class="h5 pl-2 b-0">
|
||||||
<a class="icon-settings text-muted" href="{{route('settings')}}"></a>
|
<a class="icon-settings text-muted" href="{{route('settings')}}"></a>
|
||||||
</span>
|
</span>
|
||||||
@elseif ($following == true)
|
@elseif ($is_following == true)
|
||||||
<span class="pl-4">
|
<span class="pl-4">
|
||||||
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="unfollow">
|
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="unfollow">
|
||||||
@csrf
|
@csrf
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<button class="btn btn-outline-secondary font-weight-bold px-4 py-0" type="submit">Unfollow</button>
|
<button class="btn btn-outline-secondary font-weight-bold px-4 py-0" type="submit">Unfollow</button>
|
||||||
</form>
|
</form>
|
||||||
</span>
|
</span>
|
||||||
@elseif ($following == false)
|
@elseif ($is_following == false)
|
||||||
<span class="pl-4">
|
<span class="pl-4">
|
||||||
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="follow">
|
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="follow">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
Loading…
Reference in a new issue