diff --git a/components/SourceSubmitForm.vue b/components/SourceSubmitForm.vue
index bd906699..3916c97c 100644
--- a/components/SourceSubmitForm.vue
+++ b/components/SourceSubmitForm.vue
@@ -77,6 +77,12 @@
+
nouns.editing
@@ -110,6 +116,7 @@
fragments: [],
comment: '',
link: '',
+ key: null,
base: null,
},
@@ -136,6 +143,7 @@
fragments: [],
comment: '',
link: '',
+ key: null,
base: null,
}
},
@@ -150,6 +158,7 @@
fragments: source.fragments,
comment: source.comment,
link: source.link,
+ key: source.key,
base: source.id,
}
this.afterSubmit = false;
diff --git a/locale/en/translations.suml b/locale/en/translations.suml
index b6c0632e..19089794 100644
--- a/locale/en/translations.suml
+++ b/locale/en/translations.suml
@@ -94,6 +94,9 @@ sources:
thanks: 'Thanks for contributing!'
another: 'Submit another one'
moderation: 'Submissions will have to get approved before getting published.'
+ key: 'Key'
+ keyInfo: 'Identifier for linking sources between language versions and linking with the dictionary'
+
nouns:
header: 'Dictionary'
diff --git a/locale/es/translations.suml b/locale/es/translations.suml
index 34a1436a..2fa30534 100644
--- a/locale/es/translations.suml
+++ b/locale/es/translations.suml
@@ -94,6 +94,8 @@ sources:
thanks: '¡Gracias por contribuir!'
another: 'Enviar otro'
moderation: 'Los envíos deben ser aprobados antes de ser publicados.'
+ key: 'Key' # TODO
+ keyInfo: 'Identifier for linking sources between language versions and linking with the dictionary' # TODO
nouns:
header: 'Diccionario'
diff --git a/locale/pl/translations.suml b/locale/pl/translations.suml
index 7b04f1b4..0fe6e4e4 100644
--- a/locale/pl/translations.suml
+++ b/locale/pl/translations.suml
@@ -193,6 +193,8 @@ sources:
thanks: 'Dziękujemy za zgłoszenie!'
another: 'Zgłoś kolejne źródło'
moderation: 'Propozycje będą musiały zostać zatwierdzone przed opublikowaniem.'
+ key: 'Klucz'
+ keyInfo: 'Identyfikator do łączenia tekstów między wersjami językowymi i łączenia ze słownikiem'
nouns:
header: 'Słowniki'
diff --git a/locale/zh/translations.suml b/locale/zh/translations.suml
index b24c386c..2748156a 100644
--- a/locale/zh/translations.suml
+++ b/locale/zh/translations.suml
@@ -92,6 +92,8 @@ sources:
thanks: '感謝您的貢獻!'
another: '提交另一個'
moderation: '提交的內容必須先獲得批准才能發布。'
+ key: 'Key' # TODO
+ keyInfo: 'Identifier for linking sources between language versions and linking with the dictionary' # TODO
nouns:
header: '字典'
diff --git a/migrations/017-source-key.sql b/migrations/017-source-key.sql
new file mode 100644
index 00000000..d4e09c10
--- /dev/null
+++ b/migrations/017-source-key.sql
@@ -0,0 +1,5 @@
+-- Up
+
+ALTER TABLE sources ADD COLUMN key TEXT NULL DEFAULT NULL;
+
+-- Down
diff --git a/server/routes/sources.js b/server/routes/sources.js
index d909d3d5..859f51df 100644
--- a/server/routes/sources.js
+++ b/server/routes/sources.js
@@ -44,11 +44,11 @@ router.get('/sources/:id', async (req, res) => {
router.post('/sources/submit', 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, submitter_id, base_id)
+ INSERT INTO sources (id, locale, pronouns, type, author, title, extra, year, fragments, comment, link, key, submitter_id, base_id)
VALUES (
${id}, ${req.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},
+ ${req.body.fragments.join('@').replace(/\n/g, '|')}, ${req.body.comment}, ${req.body.link}, ${req.body.key || null},
${req.user ? req.user.id : null}, ${req.body.base}
)
`);
diff --git a/src/classes.js b/src/classes.js
index 2f0fadbd..4ecee205 100644
--- a/src/classes.js
+++ b/src/classes.js
@@ -99,7 +99,7 @@ function clone(mainObject) {
}
export class Source {
- constructor ({id, pronouns, type, author, title, extra, year, fragments = '', comment = null, link = null, submitter = null, approved, base_id = null,}) {
+ constructor ({id, pronouns, type, author, title, extra, year, fragments = '', comment = null, link = null, key = null, submitter = null, approved, base_id = null,}) {
this.id = id;
this.pronouns = pronouns ? pronouns.split(';') : [];
this.type = type;
@@ -110,6 +110,7 @@ export class Source {
this.fragments = fragments ? fragments.replace(/\|/g, '\n').split('@') : [];
this.comment = comment;
this.link = link;
+ this.key = key;
this.submitter = submitter;
this.approved = approved;
this.base_id = base_id;