mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Added follower count
This commit is contained in:
parent
bd330a1089
commit
4714f04a80
4 changed files with 24 additions and 4 deletions
|
@ -28,6 +28,7 @@ use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase;
|
||||||
use Poniverse\Ponyfm\Models\Image;
|
use Poniverse\Ponyfm\Models\Image;
|
||||||
use Poniverse\Ponyfm\Models\Track;
|
use Poniverse\Ponyfm\Models\Track;
|
||||||
use Poniverse\Ponyfm\Models\User;
|
use Poniverse\Ponyfm\Models\User;
|
||||||
|
use Poniverse\Ponyfm\Models\Follower;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Input;
|
use Illuminate\Support\Facades\Input;
|
||||||
use Illuminate\Support\Facades\Response;
|
use Illuminate\Support\Facades\Response;
|
||||||
|
@ -173,6 +174,9 @@ class ArtistsController extends ApiControllerBase
|
||||||
$palette = ColorThief::getPalette($user->getAvatarUrl(Image::SMALL), 2);
|
$palette = ColorThief::getPalette($user->getAvatarUrl(Image::SMALL), 2);
|
||||||
$formatted_palette = array_map("Helpers::rgb2hex", $palette);
|
$formatted_palette = array_map("Helpers::rgb2hex", $palette);
|
||||||
|
|
||||||
|
$followers = Follower::where('artist_id', $user->id)
|
||||||
|
->count();
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'artist' => [
|
'artist' => [
|
||||||
'id' => $user->id,
|
'id' => $user->id,
|
||||||
|
@ -185,7 +189,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
],
|
],
|
||||||
'avatar_colors' => $formatted_palette,
|
'avatar_colors' => $formatted_palette,
|
||||||
'created_at' => $user->created_at,
|
'created_at' => $user->created_at,
|
||||||
'followers' => [],
|
'followers' => $followers,
|
||||||
'following' => [],
|
'following' => [],
|
||||||
'latest_tracks' => $latestTracks,
|
'latest_tracks' => $latestTracks,
|
||||||
'comments' => $comments,
|
'comments' => $comments,
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
<img src="{{artist.avatars.normal}}">
|
<img src="{{artist.avatars.normal}}">
|
||||||
<div class="artist-right">
|
<div class="artist-right">
|
||||||
<h1>{{artist.name}}<i class="fa fa-star admin-star" ng-show="::artist.isAdmin" data-title="Admin" bs-tooltip></i></h1>
|
<h1>{{artist.name}}<i class="fa fa-star admin-star" ng-show="::artist.isAdmin" data-title="Admin" bs-tooltip></i></h1>
|
||||||
|
<p class="follower-count">
|
||||||
|
<ng-pluralize count="artist.followers"
|
||||||
|
when="{'0': 'No followers',
|
||||||
|
'one': '1 follower',
|
||||||
|
'other': '{} followers'}">
|
||||||
|
</ng-pluralize>
|
||||||
|
</p>
|
||||||
<a href="#" class="btn btn-default" ng-class="{'btn-primary': !artist.user_data.is_following}" ng-show="auth.isLogged && auth.user.id != artist.id" pfm-eat-click ng-click="toggleFollow()">
|
<a href="#" class="btn btn-default" ng-class="{'btn-primary': !artist.user_data.is_following}" ng-show="auth.isLogged && auth.user.id != artist.id" pfm-eat-click ng-click="toggleFollow()">
|
||||||
<span ng-if="!artist.user_data.is_following">Follow</span>
|
<span ng-if="!artist.user_data.is_following">Follow</span>
|
||||||
<span ng-if="artist.user_data.is_following">Following!</span>
|
<span ng-if="artist.user_data.is_following">Following!</span>
|
||||||
|
|
10
resources/assets/styles/content.less
vendored
10
resources/assets/styles/content.less
vendored
|
@ -158,17 +158,21 @@
|
||||||
margin-left: 165px;
|
margin-left: 165px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
|
||||||
> h1 {
|
> h1, .follower-count {
|
||||||
font-size: 20pt;
|
font-size: 20pt;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: rgba(0,0,0,0.5);
|
background: rgba(0,0,0,0.5);
|
||||||
display: inline;
|
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .follower-count {
|
||||||
|
font-size: 14pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .btn {
|
> .btn {
|
||||||
display: table;
|
display: table;
|
||||||
margin-top: 10px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
resources/assets/styles/mobile.less
vendored
5
resources/assets/styles/mobile.less
vendored
|
@ -191,6 +191,11 @@
|
||||||
margin-top: 15px !important;
|
margin-top: 15px !important;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
> h1, .follower-count {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
> .btn {
|
> .btn {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|
Loading…
Reference in a new issue