Added archive filter to tracks page

This commit is contained in:
Josef Citrine 2017-05-16 21:08:46 +01:00
parent 1f74636a39
commit afa9e8f50e
3 changed files with 25 additions and 0 deletions

View file

@ -357,6 +357,11 @@ class TracksController extends ApiControllerBase
$query->whereIn('show_song_track.show_song_id', Request::get('songs'));
}
if (Request::has('archive')) {
// Select which archive to view
$query->where('source', Request::get('archive'));
}
return $query;
}
}

View file

@ -63,6 +63,17 @@
</li>
</ul>
</li>
<li class="dropdown" ng-class="{'has-filter': !query.filters.archive.isDefault}">
<a class="dropdown-toggle btn btn-default" bs-dropdown>
Archive: <strong>{{query.filters.archive.title}}</strong>
</a>
<a class="btn btn-default" pfm-eat-click ng-click="clearFilter('archive')"><i class="fa fa-remove"></i></a>
<ul class="dropdown-menu">
<li ng-repeat="filter in ::filters.archive.values track by $index" ng-class="{selected: filter == query.filters.archive}">
<a pfm-eat-click href="#" ng-click="setFilter('archive', filter)">{{::filter.title}}</a>
</li>
</ul>
</li>
</ul>
<div class="pagination" ng-if="totalPages > 1">

View file

@ -238,6 +238,15 @@ module.exports = angular.module('ponyfm').factory('tracks', [
name: 'songs'
values: []
filterName: 'songs'
self.filters.archive =
type: 'single'
name: 'archive'
values: [
{title: 'None', query: '', isDefault: true, filter: ''}
{title: 'MLP Music Archive', query: 'mlpma', isDefault: false, filter: 'archive=mlpma'}
{title: 'Ponify', query: 'ponify', isDefault: false, filter: 'archive=ponify'}
]
taxonomies.refresh().done (taxes) ->
for genre in taxes.genresWithTracks