Re-added date ranges.

This commit is contained in:
ThePendulum 2019-12-18 02:42:55 +01:00
parent 3845c3f52d
commit 9b17add4e2
7 changed files with 53 additions and 41 deletions

View File

@ -1,20 +1,6 @@
<template> <template>
<div class="filter-bar noselect"> <div class="filter-bar noselect">
<span> <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"> <label class="range">
<input <input
:id="`${_uid}-new`" :id="`${_uid}-new`"
@ -42,6 +28,20 @@
class="range-button" class="range-button"
>Upcoming</label> >Upcoming</label>
</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>
<span> <span>

View File

@ -16,6 +16,7 @@
> >
<img <img
:src="`/img/${tag.poster.thumbnail}`" :src="`/img/${tag.poster.thumbnail}`"
:alt="tag.poster.comment"
class="poster" class="poster"
> >
</a> </a>
@ -43,6 +44,7 @@
> >
<img <img
:src="`/img/${photo.thumbnail}`" :src="`/img/${photo.thumbnail}`"
:alt="photo.comment"
class="photo" class="photo"
> >
</a> </a>

View File

@ -27,8 +27,9 @@
v-if="actor.age || actor.origin" v-if="actor.age || actor.origin"
class="details" class="details"
> >
<span v-if="actor.age"> <span>
<span <span
v-if="actor.age"
v-tooltip="`Born on ${formatDate(actor.birthdate, 'MMMM D, YYYY')}`" v-tooltip="`Born on ${formatDate(actor.birthdate, 'MMMM D, YYYY')}`"
class="age" class="age"
>{{ actor.age }}</span> >{{ actor.age }}</span>

View File

@ -71,7 +71,16 @@ const releaseTrailerFragment = `
`; `;
const releasesFragment = ` const releasesFragment = `
releases(first:$limit, orderBy: DATE_DESC) { releases(
filter: {
date: {
lessThan: $before,
greaterThan: $after,
}
},
first: $limit,
orderBy: DATE_DESC,
) {
id id
title title
date date

View File

@ -2,22 +2,22 @@ import { graphql } from '../api';
import { releasesFragment, releaseFragment } from '../fragments'; import { releasesFragment, releaseFragment } from '../fragments';
import { curateRelease } from '../curate'; import { curateRelease } from '../curate';
function initReleasesActions(_store, _router) { function initReleasesActions(store, _router) {
async function fetchReleases({ _commit }, { limit = 100 }) { async function fetchReleases({ _commit }, { limit = 100 }) {
/* console.log(store.state.ui.filter, store.getters.after, store.getters.before);
const releases = await get('/releases', {
filter: store.state.ui.filter,
after: store.getters.after,
before: store.getters.before,
});
*/
const { releases } = await graphql(` const { releases } = await graphql(`
query Releases($limit:Int!) { query Releases(
$limit:Int = 1000,
$after:Date = "1900-01-01",
$before:Date = "2100-01-01",
) {
${releasesFragment} ${releasesFragment}
} }
`, { `, {
limit, limit,
after: store.getters.after,
before: store.getters.before,
}); });
return releases.map(release => curateRelease(release)); return releases.map(release => curateRelease(release));

View File

@ -2,16 +2,16 @@ import dayjs from 'dayjs';
const dateRanges = { const dateRanges = {
new: () => ({ new: () => ({
after: dayjs(new Date(0)).format('YYYY-MM-DD'), after: '1900-01-01',
before: dayjs(new Date()).format('YYYY-MM-DD'), before: dayjs(new Date()).add(1, 'day').format('YYYY-MM-DD'),
}), }),
upcoming: () => ({ upcoming: () => ({
after: dayjs(new Date()).format('YYYY-MM-DD'), after: dayjs(new Date()).format('YYYY-MM-DD'),
before: dayjs(new Date(2 ** 42)).format('YYYY-MM-DD'), before: '2100-01-01',
}), }),
all: () => ({ all: () => ({
after: dayjs(new Date(0)).format('YYYY-MM-DD'), after: '1900-01-01',
before: dayjs(new Date(2 ** 42)).format('YYYY-MM-DD'), before: '2100-01-01',
}), }),
}; };

View File

@ -294,7 +294,7 @@ exports.up = knex => Promise.resolve()
CREATE VIEW actors_media AS SELECT * FROM media WHERE domain = 'actors'; CREATE VIEW actors_media AS SELECT * FROM media WHERE domain = 'actors';
CREATE VIEW tags_media AS SELECT * FROM media WHERE domain = 'tags'; 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 */ /* 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; 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;