From ab241275aae23da9a49223b917bc341ea9ded00e Mon Sep 17 00:00:00 2001 From: Andrea Date: Mon, 28 Feb 2022 13:07:39 +0100 Subject: [PATCH] [sources] spoiler checkbox --- components/Source.vue | 23 ++++++++++++++++------- components/SourceSubmitForm.vue | 11 +++++++++++ locale/_base/translations.suml | 2 +- locale/de/translations.suml | 1 + locale/en/translations.suml | 2 +- locale/eo/translations.suml | 1 + locale/es/translations.suml | 9 +++++---- locale/fr/translations.suml | 1 + locale/gl/translations.suml | 1 + locale/it/translations.suml | 1 + locale/ja/translations.suml | 1 + locale/ko/translations.suml | 1 + locale/lad/translations.suml | 1 + locale/nl/translations.suml | 1 + locale/no/translations.suml | 1 + locale/pl/translations.suml | 1 + locale/pt/translations.suml | 1 + locale/ru/translations.suml | 1 + locale/sv/translations.suml | 1 + locale/yi/translations.suml | 1 + locale/zh/translations.suml | 3 ++- migrations/051-source-spoiler.sql | 6 ++++++ server/routes/sources.js | 4 ++-- src/classes.js | 3 ++- 24 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 migrations/051-source-spoiler.sql diff --git a/components/Source.vue b/components/Source.vue index 0b6302f2..eed7633a 100644 --- a/components/Source.vue +++ b/components/Source.vue @@ -58,14 +58,22 @@ -
- +
+ +
+
+
+ +
+
    +
  • + quotation.startquotation.end +
  • +
-
    -
  • - quotation.startquotation.end -
  • -

+
+
+ +
+

@@ -128,6 +136,7 @@ comment: '', images: [], link: '', + spoiler: false, key: null, base: null, }, @@ -158,6 +167,7 @@ comment: '', images: [], link: '', + spoiler: false, key: null, base: null, } @@ -177,6 +187,7 @@ comment: source.comment, images: source.images, link: source.link, + spoiler: source.spoiler, key: source.key, base: source.id, } diff --git a/locale/_base/translations.suml b/locale/_base/translations.suml index 66fad3dd..363985dc 100644 --- a/locale/_base/translations.suml +++ b/locale/_base/translations.suml @@ -119,10 +119,10 @@ sources: key: 'Key' keyInfo: 'Identifier for linking sources between language versions and linking with the dictionary' images: 'Images' + spoiler: 'Spoiler' # TODO otherVersions: 'In other languages' referenced: 'Examples of use' - nouns: header: 'Dictionary' headerLong: 'Dictionary of neutral nouns' diff --git a/locale/de/translations.suml b/locale/de/translations.suml index af89fe26..a181f6b6 100644 --- a/locale/de/translations.suml +++ b/locale/de/translations.suml @@ -113,6 +113,7 @@ sources: key: 'Schlüssel' keyInfo: 'Kennzeichen, um Quellen zwischen Sprachversionen und dem Wörterbuch zu verbinden' images: 'Bilder' + spoiler: 'Spoiler' # TODO otherVersions: 'In anderen Sprachen' referenced: 'Beispiele zur Benutzung' diff --git a/locale/en/translations.suml b/locale/en/translations.suml index 4a3d3624..04438dd9 100644 --- a/locale/en/translations.suml +++ b/locale/en/translations.suml @@ -120,10 +120,10 @@ sources: key: 'Key' keyInfo: 'Identifier for linking sources between language versions and linking with the dictionary' images: 'Images' + spoiler: 'Spoiler' otherVersions: 'In other languages' referenced: 'Examples of use' - nouns: header: 'Dictionary' headerLong: 'Dictionary of neutral nouns' diff --git a/locale/eo/translations.suml b/locale/eo/translations.suml index f9e2c1f3..73a7a34b 100644 --- a/locale/eo/translations.suml +++ b/locale/eo/translations.suml @@ -107,6 +107,7 @@ sources: key: 'Ŝlosilo' keyInfo: 'Identigilo por ligi fontojn inter lingvoversiojn kaj ligado al la vortaro' images: 'Bildoj' + spoiler: 'Spoiler' # TODO otherVersions: 'En aliaj lingvoj' referenced: 'Ekzemploj de uzo' diff --git a/locale/es/translations.suml b/locale/es/translations.suml index 2ccf8d2c..1d541293 100644 --- a/locale/es/translations.suml +++ b/locale/es/translations.suml @@ -118,6 +118,7 @@ sources: key: 'Clave' keyInfo: 'Identificador para vincular fuentes entre versiones en varios idiomas y vincularlas con el diccionario' images: 'Imágenes' + spoiler: 'Spoiler' # TODO otherVersions: 'En otros idiomas' referenced: 'Ejemplos del uso' @@ -348,12 +349,12 @@ faq: - > No. - > - Gestionar la lista de banderas y etiquetas es una tarea que toma demasiado tiempo para nuestro equipo. - De igual manera, es desafiante en términos de filtrar trolls y vándalxs, de identidades válidas y en buena fe. + Gestionar la lista de banderas y etiquetas es una tarea que toma demasiado tiempo para nuestro equipo. + De igual manera, es desafiante en términos de filtrar trolls y vándalxs, de identidades válidas y en buena fe. Nosotrxs no queremos ser la policía de la identidad. Tampoco queremos pasar todo nuestro tiempo gestionando las banderas. Es un proyecto acerca de lenguaje y pronombres, después de todo, no de banderas. Son sólo un bonus. - > - Hicimos nuestro mejor esfuerzo para seleccionar una lista de banderas que sean populares y, a nuestro mejor conocimiento, generalmente aceptadas. + Hicimos nuestro mejor esfuerzo para seleccionar una lista de banderas que sean populares y, a nuestro mejor conocimiento, generalmente aceptadas. No planeamos aumentar o reducir esta lista. - > Estamos conscientes de que algunas banderas pueden no ser del agrado de algunxs @@ -361,7 +362,7 @@ faq: debido a múltiples definiciones que causan confusión, o incluso debido a aspectos de la vida de un personaje mítico). Nosotrxs somos queer y trans, nos importan nuestrxs hermanxs trans. - Desafortunadamente, es realmente difícil tomar tales decisiones + Desafortunadamente, es realmente difícil tomar tales decisiones cuando recibimos mensajes de personas trans pidiéndonos que añadamos una bandera con la que se identifican de forma honesta, e igual de otras personas trans pidiéndonos que la removamos debido a que de alguna manera, lastima a las personas trans. La historia de cada etiqueta no es tan clara, no hay una autoridad académica para investigar al respecto. diff --git a/locale/fr/translations.suml b/locale/fr/translations.suml index d069bb75..f20d41bb 100644 --- a/locale/fr/translations.suml +++ b/locale/fr/translations.suml @@ -116,6 +116,7 @@ sources: key: 'Key' keyInfo: 'Identifiant pour relier les sources entre les versions linguistiques et établir des liens avec le dictionnaire' images: 'Images' + spoiler: 'Spoiler' # TODO otherVersions: 'Dans d’autres langues' referenced: 'Exemples d’usage' diff --git a/locale/gl/translations.suml b/locale/gl/translations.suml index f5710b04..49b0db79 100644 --- a/locale/gl/translations.suml +++ b/locale/gl/translations.suml @@ -116,6 +116,7 @@ sources: key: 'Chave' keyInfo: 'Identificador para conectar fontes entre versões e conectar com dicionário' images: 'Imagens' + spoiler: 'Spoiler' # TODO otherVersions: 'Em outros idiomas' referenced: 'Exemplos de uso' diff --git a/locale/it/translations.suml b/locale/it/translations.suml index 4a8aaeb6..110b7987 100644 --- a/locale/it/translations.suml +++ b/locale/it/translations.suml @@ -119,6 +119,7 @@ sources: key: 'Key' keyInfo: 'Identifier for linking sources between language versions and linking with the dictionary' images: 'Images' + spoiler: 'Spoiler' # TODO otherVersions: 'In other languages' referenced: 'Examples of use' diff --git a/locale/ja/translations.suml b/locale/ja/translations.suml index 248db0d2..ae0000b9 100644 --- a/locale/ja/translations.suml +++ b/locale/ja/translations.suml @@ -116,6 +116,7 @@ sources: key: 'キー' keyInfo: '言語間、及び辞書とリンクするのための識別子' images: '画像' + spoiler: 'Spoiler' # TODO otherVersions: '他の言語で' referenced: '使用例' diff --git a/locale/ko/translations.suml b/locale/ko/translations.suml index 7a9a588a..e5e2100d 100644 --- a/locale/ko/translations.suml +++ b/locale/ko/translations.suml @@ -118,6 +118,7 @@ sources: key: '키' keyInfo: '언어 버전 간 소스 연결 및 사전 연결 식별자' images: '이미지' + spoiler: 'Spoiler' # TODO otherVersions: '다른 언어' referenced: '사용 예' diff --git a/locale/lad/translations.suml b/locale/lad/translations.suml index c47e9189..213f48a1 100644 --- a/locale/lad/translations.suml +++ b/locale/lad/translations.suml @@ -118,6 +118,7 @@ sources: key: 'Yave' keyInfo: 'Identifiador para atar fuentes entre versiones en varias linguas i atarlas kon el diksionaryo' images: 'Imajes' + spoiler: 'Spoiler' # TODO otherVersions: 'En otras linguas' referenced: 'Enshemplos del uzo' diff --git a/locale/nl/translations.suml b/locale/nl/translations.suml index 976d39b3..2c7a5538 100644 --- a/locale/nl/translations.suml +++ b/locale/nl/translations.suml @@ -117,6 +117,7 @@ sources: key: 'Sleutel' keyInfo: 'Identifier om bronnen te linken tussen verschillende vertalingen van de website en om met het woordenboek te linken' images: 'Afbeeldingen' + spoiler: 'Spoiler' # TODO otherVersions: 'In andere talen' referenced: 'Gebruiksvoorbeelden' diff --git a/locale/no/translations.suml b/locale/no/translations.suml index dcd31dc1..cbbac48c 100644 --- a/locale/no/translations.suml +++ b/locale/no/translations.suml @@ -117,6 +117,7 @@ sources: key: 'Nøkkel' keyInfo: 'identifiserer for å linke kilder mellom språk versjoner og linker med ordboken' images: 'Bilder' + spoiler: 'Spoiler' # TODO otherVersions: 'På andre språk' referenced: 'Eksempler på bruk i setninger' diff --git a/locale/pl/translations.suml b/locale/pl/translations.suml index 158e717f..67ebc328 100644 --- a/locale/pl/translations.suml +++ b/locale/pl/translations.suml @@ -132,6 +132,7 @@ sources: key: 'Klucz' keyInfo: 'Identyfikator do łączenia tekstów między wersjami językowymi i łączenia ze słownikiem' images: 'Obrazki' + spoiler: 'Spoiler' otherVersions: 'W innych językach' referenced: 'Przykłady użycia' diff --git a/locale/pt/translations.suml b/locale/pt/translations.suml index b43468f0..e13e73c0 100644 --- a/locale/pt/translations.suml +++ b/locale/pt/translations.suml @@ -117,6 +117,7 @@ sources: key: 'Chave' keyInfo: 'Identificador para conectar fontes entre versões e conectar com dicionário' images: 'Imagens' + spoiler: 'Spoiler' # TODO otherVersions: 'Em outros idiomas' referenced: 'Exemplos de uso' diff --git a/locale/ru/translations.suml b/locale/ru/translations.suml index 8354feb6..80e2c1b0 100644 --- a/locale/ru/translations.suml +++ b/locale/ru/translations.suml @@ -108,6 +108,7 @@ sources: key: 'Ключ' keyInfo: 'Идентификатор, используемый для связки источников из разных языковых версий и связки со словарём' images: 'Изображения' + spoiler: 'Spoiler' # TODO otherVersions: 'На других языках' referenced: 'Примеры употребления' diff --git a/locale/sv/translations.suml b/locale/sv/translations.suml index 14d9c371..0ca6c5d8 100644 --- a/locale/sv/translations.suml +++ b/locale/sv/translations.suml @@ -120,6 +120,7 @@ sources: key: 'Nyckel' keyInfo: 'Identifierare för att länka källor mellan språkversioner och länka till ordbok' images: 'Bilder' + spoiler: 'Spoiler' # TODO otherVersions: 'På andra språk' referenced: 'Exempel på användning' diff --git a/locale/yi/translations.suml b/locale/yi/translations.suml index ca30623e..504a40c8 100644 --- a/locale/yi/translations.suml +++ b/locale/yi/translations.suml @@ -116,6 +116,7 @@ sources: key: 'Key' keyInfo: 'Identifier for linking sources between language versions and linking with the dictionary' images: 'Images' + spoiler: 'Spoiler' # TODO otherVersions: 'In other languages' referenced: 'Examples of use' diff --git a/locale/zh/translations.suml b/locale/zh/translations.suml index a5923f0d..addc0581 100644 --- a/locale/zh/translations.suml +++ b/locale/zh/translations.suml @@ -92,7 +92,7 @@ sources: Series: '電視劇' Song: '音樂' Poetry: '詩歌' - Comics: '漫畫' + Comics: '漫畫' Game: '遊戲' Other: '其他' submit: @@ -114,6 +114,7 @@ sources: key: '键' keyInfo: '用于在语言版本之间链接源并与字典链接的标识符' images: '意象' + spoiler: 'Spoiler' # TODO otherVersions: '在其他語言' referenced: '榜樣' diff --git a/migrations/051-source-spoiler.sql b/migrations/051-source-spoiler.sql new file mode 100644 index 00000000..27725aa1 --- /dev/null +++ b/migrations/051-source-spoiler.sql @@ -0,0 +1,6 @@ +-- Up + +ALTER TABLE sources ADD COLUMN spoiler INTEGER NOT NULL DEFAULT 0; + +-- Down + diff --git a/server/routes/sources.js b/server/routes/sources.js index d3e4c6eb..d631f066 100644 --- a/server/routes/sources.js +++ b/server/routes/sources.js @@ -89,12 +89,12 @@ router.post('/sources/submit', handleErrorAsync(async (req, res) => { const id = ulid(); await req.db.get(SQL` - INSERT INTO sources (id, locale, pronouns, type, author, title, extra, year, fragments, comment, link, key, images, submitter_id, base_id) + INSERT INTO sources (id, locale, pronouns, type, author, title, extra, year, fragments, comment, link, key, images, spoiler, submitter_id, base_id) VALUES ( ${id}, ${global.config.locale}, ${req.body.pronouns.join(';')}, ${req.body.type}, ${req.body.author}, ${req.body.title}, ${req.body.extra}, ${req.body.year}, ${req.body.fragments.join('@').replace(/\n/g, '|')}, ${req.body.comment}, ${req.body.link}, - ${clearKey(req.body.key)}, ${req.body.images || null}, + ${clearKey(req.body.key)}, ${req.body.images || null}, ${req.body.spoiler ? 1 : 0}, ${req.user ? req.user.id : null}, ${req.body.base} ) `); diff --git a/src/classes.js b/src/classes.js index 1920e41e..103f99b2 100644 --- a/src/classes.js +++ b/src/classes.js @@ -101,7 +101,7 @@ function clone(mainObject) { export class Source { constructor ({ id, pronouns, type, author, title, extra, year, fragments = '', - comment = null, link = null, + comment = null, link = null, spoiler = false, submitter = null, approved, base_id = null, key = null, versions = [], locale = config.locale, images = null, @@ -118,6 +118,7 @@ export class Source { : []; this.comment = comment; this.link = link; + this.spoiler = !!spoiler; this.submitter = submitter; this.approved = approved; this.base_id = base_id;