Re-added date ranges.
This commit is contained in:
parent
3845c3f52d
commit
9b17add4e2
|
@ -1,20 +1,6 @@
|
|||
<template>
|
||||
<div class="filter-bar noselect">
|
||||
<span>
|
||||
<label class="range">
|
||||
<input
|
||||
:id="`${_uid}-all`"
|
||||
:checked="range === 'all'"
|
||||
type="radio"
|
||||
class="range-input"
|
||||
@click="setRange('all')"
|
||||
>
|
||||
<label
|
||||
:for="`${_uid}-all`"
|
||||
class="range-button"
|
||||
>All</label>
|
||||
</label>
|
||||
|
||||
<label class="range">
|
||||
<input
|
||||
:id="`${_uid}-new`"
|
||||
|
@ -42,6 +28,20 @@
|
|||
class="range-button"
|
||||
>Upcoming</label>
|
||||
</label>
|
||||
|
||||
<label class="range">
|
||||
<input
|
||||
:id="`${_uid}-all`"
|
||||
:checked="range === 'all'"
|
||||
type="radio"
|
||||
class="range-input"
|
||||
@click="setRange('all')"
|
||||
>
|
||||
<label
|
||||
:for="`${_uid}-all`"
|
||||
class="range-button"
|
||||
>All</label>
|
||||
</label>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
>
|
||||
<img
|
||||
:src="`/img/${tag.poster.thumbnail}`"
|
||||
:alt="tag.poster.comment"
|
||||
class="poster"
|
||||
>
|
||||
</a>
|
||||
|
@ -43,6 +44,7 @@
|
|||
>
|
||||
<img
|
||||
:src="`/img/${photo.thumbnail}`"
|
||||
:alt="photo.comment"
|
||||
class="photo"
|
||||
>
|
||||
</a>
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
v-if="actor.age || actor.origin"
|
||||
class="details"
|
||||
>
|
||||
<span v-if="actor.age">
|
||||
<span>
|
||||
<span
|
||||
v-if="actor.age"
|
||||
v-tooltip="`Born on ${formatDate(actor.birthdate, 'MMMM D, YYYY')}`"
|
||||
class="age"
|
||||
>{{ actor.age }}</span>
|
||||
|
|
|
@ -71,7 +71,16 @@ const releaseTrailerFragment = `
|
|||
`;
|
||||
|
||||
const releasesFragment = `
|
||||
releases(first:$limit, orderBy: DATE_DESC) {
|
||||
releases(
|
||||
filter: {
|
||||
date: {
|
||||
lessThan: $before,
|
||||
greaterThan: $after,
|
||||
}
|
||||
},
|
||||
first: $limit,
|
||||
orderBy: DATE_DESC,
|
||||
) {
|
||||
id
|
||||
title
|
||||
date
|
||||
|
|
|
@ -2,22 +2,22 @@ import { graphql } from '../api';
|
|||
import { releasesFragment, releaseFragment } from '../fragments';
|
||||
import { curateRelease } from '../curate';
|
||||
|
||||
function initReleasesActions(_store, _router) {
|
||||
function initReleasesActions(store, _router) {
|
||||
async function fetchReleases({ _commit }, { limit = 100 }) {
|
||||
/*
|
||||
const releases = await get('/releases', {
|
||||
filter: store.state.ui.filter,
|
||||
after: store.getters.after,
|
||||
before: store.getters.before,
|
||||
});
|
||||
*/
|
||||
console.log(store.state.ui.filter, store.getters.after, store.getters.before);
|
||||
|
||||
const { releases } = await graphql(`
|
||||
query Releases($limit:Int!) {
|
||||
query Releases(
|
||||
$limit:Int = 1000,
|
||||
$after:Date = "1900-01-01",
|
||||
$before:Date = "2100-01-01",
|
||||
) {
|
||||
${releasesFragment}
|
||||
}
|
||||
`, {
|
||||
limit,
|
||||
after: store.getters.after,
|
||||
before: store.getters.before,
|
||||
});
|
||||
|
||||
return releases.map(release => curateRelease(release));
|
||||
|
|
|
@ -2,16 +2,16 @@ import dayjs from 'dayjs';
|
|||
|
||||
const dateRanges = {
|
||||
new: () => ({
|
||||
after: dayjs(new Date(0)).format('YYYY-MM-DD'),
|
||||
before: dayjs(new Date()).format('YYYY-MM-DD'),
|
||||
after: '1900-01-01',
|
||||
before: dayjs(new Date()).add(1, 'day').format('YYYY-MM-DD'),
|
||||
}),
|
||||
upcoming: () => ({
|
||||
after: dayjs(new Date()).format('YYYY-MM-DD'),
|
||||
before: dayjs(new Date(2 ** 42)).format('YYYY-MM-DD'),
|
||||
before: '2100-01-01',
|
||||
}),
|
||||
all: () => ({
|
||||
after: dayjs(new Date(0)).format('YYYY-MM-DD'),
|
||||
before: dayjs(new Date(2 ** 42)).format('YYYY-MM-DD'),
|
||||
after: '1900-01-01',
|
||||
before: '2100-01-01',
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ exports.up = knex => Promise.resolve()
|
|||
CREATE VIEW actors_media AS SELECT * FROM media WHERE domain = 'actors';
|
||||
CREATE VIEW tags_media AS SELECT * FROM media WHERE domain = 'tags';
|
||||
|
||||
CREATE VIEW releases_tags AS SELECT * FROM tags_associated WHERE domain = 'releases';
|
||||
CREATE VIEW releases_tags AS SELECT tags_associated.*,tags.slug FROM tags_associated LEFT JOIN tags ON tags_associated.tag_id = tags.id WHERE domain = 'releases';
|
||||
/* used for sorting release actors and tags */
|
||||
CREATE VIEW releases_actors AS SELECT actors_associated.*,actors.gender,actors.birthdate FROM actors_associated LEFT JOIN actors ON actors_associated.actor_id = actors.id;
|
||||
|
||||
|
|
Loading…
Reference in New Issue