mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-16 18:14:23 +01:00
Include a link to the genre's content in the genre editor.
This commit is contained in:
parent
2bd6a0b258
commit
be23475ae5
3 changed files with 11 additions and 3 deletions
|
@ -24,13 +24,14 @@ use DB;
|
|||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Poniverse\Ponyfm\Traits\SlugTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use URL;
|
||||
use Venturecraft\Revisionable\RevisionableTrait;
|
||||
|
||||
class Genre extends Model
|
||||
{
|
||||
protected $table = 'genres';
|
||||
protected $fillable = ['name', 'slug'];
|
||||
protected $appends = ['track_count'];
|
||||
protected $appends = ['track_count', 'url'];
|
||||
protected $hidden = ['trackCountRelation'];
|
||||
|
||||
public $timestamps = false;
|
||||
|
@ -63,4 +64,11 @@ class Genre extends Model
|
|||
public function getTrackCountAttribute() {
|
||||
return $this->trackCountRelation()->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string relative, Angular-friendly URL to this genre
|
||||
*/
|
||||
public function getUrlAttribute() {
|
||||
return URL::route('tracks.discover', ['filter' => "genres-{$this->id}"], false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ if (Config::get('app.debug')) {
|
|||
}
|
||||
|
||||
Route::get('/dashboard', 'TracksController@getIndex');
|
||||
Route::get('/tracks', 'TracksController@getIndex');
|
||||
Route::get('/tracks', ['as' => 'tracks.discover', 'uses' => 'TracksController@getIndex']);
|
||||
Route::get('/tracks/popular', 'TracksController@getIndex');
|
||||
Route::get('/tracks/random', 'TracksController@getIndex');
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</td>
|
||||
<td><i ng-show="genre.isSaving" class="icon-cog icon-spin icon-large"></i></td>
|
||||
<td>{{ genre.track_count }}</td>
|
||||
<td><a ng-href="{{ genre.url }}">{{ genre.track_count }}</a></td>
|
||||
<td>
|
||||
<button class="btn btn-warning" disabled>Merge…</button>
|
||||
</td>
|
||||
|
|
Loading…
Reference in a new issue