T126: Implemented archived profiles.

This commit is contained in:
Peter Deltchev 2015-05-20 19:45:46 -07:00
parent 35af7bb681
commit de313f6452
5 changed files with 59 additions and 12 deletions

View file

@ -84,13 +84,25 @@
}
public function getShow($slug) {
$user = User::whereSlug($slug)->userDetails()->with(['comments' => function ($query) { $query->with('user'); }])->first();
$user = User::whereSlug($slug)
->userDetails()
->with(['comments' => function ($query) { $query->with('user'); }])
->first();
if (!$user)
App::abort(404);
$trackQuery = Track::summary()->published()->explicitFilter()->listed()->with('genre', 'cover', 'user')->userDetails()->whereUserId($user->id)->whereNotNull('published_at')->orderBy('created_at', 'desc')->take(20);
$latestTracks = [];
$trackQuery = Track::summary()
->published()
->explicitFilter()
->listed()
->with('genre', 'cover', 'user')
->userDetails()
->whereUserId($user->id)
->whereNotNull('published_at')
->orderBy('created_at', 'desc')
->take(20);
$latestTracks = [];
foreach ($trackQuery->get() as $track) {
$latestTracks[] = Track::mapPublicTrackSummary($track);
}
@ -116,6 +128,7 @@
'id' => $user->id,
'name' => $user->display_name,
'slug' => $user->slug,
'is_archived' => $user->is_archived,
'avatars' => [
'small' => $user->getAvatarUrl(Image::SMALL),
'normal' => $user->getAvatarUrl(Image::NORMAL)
@ -153,6 +166,7 @@
'name' => $user->display_name,
'slug' => $user->slug,
'url' => $user->url,
'is_archived' => $user->is_archived,
'avatars' => [
'small' => $user->getAvatarUrl(Image::SMALL),
'normal' => $user->getAvatarUrl(Image::NORMAL)

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddArchivedProfileField extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function ( $table ) {
$table->boolean( 'is_archived' )->default(false);
} );
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table( 'users', function ( $table ) {
$table->dropColumn( 'is_archived' );
} );
}
}

View file

@ -142,6 +142,10 @@
}
}
}
&.x-archived {
background: #eee;
}
}
.share-buttons {

View file

@ -1,4 +1,4 @@
<div class="resource-details artist-details" bindonce="artist">
<div class="resource-details artist-details" ng-class="{'x-archived': artist.is_archived}" bindonce="artist">
<ul class="dropdowns">
<li class="dropdown">
<a href="#" class="btn btn-small" ng-class="{'btn-primary': !artist.user_data.is_following}" ng-show="auth.isLogged && auth.user.id != artist.id" pfm-eat-click ng-click="toggleFollow()">
@ -6,18 +6,13 @@
<span ng-show="artist.user_data.is_following">Following!</span>
</a>
</li>
<li>
<a target="_blank" bo-href="artist.message_url" class="btn btn-small">
Send a Message
</a>
</li>
</ul>
<header>
<h1 bo-text="artist.name"></h1>
<ul class="tabs">
<li ng-class="{active: stateIncludes('content.artist.profile')}"><a href="{{artist.slug}}">Profile</a></li>
<li ng-class="{active: stateIncludes('content.artist.content')}"><a href="{{artist.slug}}/content">Content</a></li>
<li ng-class="{active: stateIncludes('content.artist.favourites')}"><a href="{{artist.slug}}/favourites">Favourites</a></li>
<li ng-hide="artist.is_archived" ng-class="{active: stateIncludes('content.artist.favourites')}"><a href="{{artist.slug}}/favourites">Favourites</a></li>
</ul>
</header>
<div class="stretch-to-bottom">

View file

@ -1,13 +1,16 @@
<div class="stretch-to-bottom">
<ul class="artist-listing">
<li ng-repeat="artist in artists" bindonce>
<li class="artist" ng-class="{'x-archived': artist.is_archived}" ng-repeat="artist in artists" bindonce>
<a href="{{artist.url}}">
<img class="image" pfm-src-loader="artist.avatars.small" pfm-src-size="small" />
<span class="info">
<span class="title" bo-text="artist.name"></span>
<span class="published">
<span ng-hide="artist.is_archived" class="published">
joined <span bo-text="artist.created_at.date | momentFromNow"></span>
</span>
<span ng-show="artist.is_archived" class="published">
archived artist
</span>
</span>
</a>
</li>