Add videos tab
parent
7c52b4f1d5
commit
06ea3401fa
|
@ -12,6 +12,7 @@ return [
|
|||
]
|
||||
],
|
||||
['name' => 'page#favorites', 'url' => '/favorites', 'verb' => 'GET'],
|
||||
['name' => 'page#videos', 'url' => '/videos', 'verb' => 'GET'],
|
||||
|
||||
// API
|
||||
['name' => 'api#days', 'url' => '/api/days', 'verb' => 'GET'],
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -74,6 +74,11 @@ class ApiController extends Controller {
|
|||
$transforms[] = array($this->timelineQuery, 'transformFavoriteFilter');
|
||||
}
|
||||
|
||||
// Filter only videos
|
||||
if ($this->request->getParam('vid')) {
|
||||
$transforms[] = array($this->timelineQuery, 'videoFilter');
|
||||
}
|
||||
|
||||
return $transforms;
|
||||
}
|
||||
|
||||
|
@ -100,6 +105,7 @@ class ApiController extends Controller {
|
|||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @return JSONResponse
|
||||
*/
|
||||
|
|
|
@ -77,4 +77,12 @@ class PageController extends Controller {
|
|||
public function favorites() {
|
||||
return $this->main();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function videos() {
|
||||
return $this->main();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use OCP\IDBConnection;
|
|||
class TimelineQuery {
|
||||
use TimelineQueryDays;
|
||||
use TimelineQueryDay;
|
||||
use TimelineQueryFavorites;
|
||||
use TimelineQueryFilters;
|
||||
|
||||
protected IDBConnection $connection;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace OCA\Memories\Db;
|
|||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\ITags;
|
||||
|
||||
trait TimelineQueryFavorites {
|
||||
trait TimelineQueryFilters {
|
||||
public function transformFavoriteFilter(IQueryBuilder $query, string $userId) {
|
||||
// Inner join will filter only the favorites
|
||||
$query->innerJoin('m', 'vcategory_to_object', 'fvco', $query->expr()->eq('fvco.objid', 'm.fileid'));
|
||||
|
@ -32,4 +32,8 @@ trait TimelineQueryFavorites {
|
|||
$query->expr()->eq('vc.category', $query->createNamedParameter(ITags::TAG_FAVORITE)),
|
||||
));
|
||||
}
|
||||
|
||||
public function videoFilter(IQueryBuilder $query, string $userId) {
|
||||
$query->andWhere($query->expr()->eq('m.isvideo', $query->createNamedParameter('1')));
|
||||
}
|
||||
}
|
|
@ -15,6 +15,10 @@
|
|||
:title="t('favorites', 'Favorites')"
|
||||
icon="icon-favorite">
|
||||
</NcAppNavigationItem>
|
||||
<NcAppNavigationItem :to="{name: 'videos'}"
|
||||
:title="t('videos', 'Videos')"
|
||||
icon="icon-video">
|
||||
</NcAppNavigationItem>
|
||||
</template>
|
||||
<template #footer>
|
||||
<NcAppNavigationSettings :title="t('memories', 'Settings')">
|
||||
|
|
|
@ -378,6 +378,11 @@ export default class Timeline extends Mixins(GlobalMixin) {
|
|||
query.set('fav', '1');
|
||||
}
|
||||
|
||||
// Videos
|
||||
if (this.$route.name === 'videos') {
|
||||
query.set('vid', '1');
|
||||
}
|
||||
|
||||
// Create query string and append to URL
|
||||
const queryStr = query.toString();
|
||||
if (queryStr) {
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
component: Timeline,
|
||||
name: 'timeline',
|
||||
props: route => ({
|
||||
rootTitle: t('timeline', 'Timeline'),
|
||||
rootTitle: t('memories', 'Timeline'),
|
||||
}),
|
||||
},
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
|||
component: Timeline,
|
||||
name: 'folders',
|
||||
props: route => ({
|
||||
rootTitle: t('folders', 'Folders'),
|
||||
rootTitle: t('memories', 'Folders'),
|
||||
}),
|
||||
},
|
||||
|
||||
|
@ -69,7 +69,16 @@
|
|||
component: Timeline,
|
||||
name: 'favorites',
|
||||
props: route => ({
|
||||
rootTitle: t('favorites', 'Favorites'),
|
||||
rootTitle: t('memories', 'Favorites'),
|
||||
}),
|
||||
},
|
||||
|
||||
{
|
||||
path: '/videos',
|
||||
component: Timeline,
|
||||
name: 'videos',
|
||||
props: route => ({
|
||||
rootTitle: t('memories', 'Videos'),
|
||||
}),
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue