+ create multilingual journal

This commit is contained in:
Phil Zhitnikov 2019-04-19 22:53:41 +03:00
parent 65802229d2
commit 8afe19deb1
4 changed files with 28 additions and 1 deletions

View File

@ -95,6 +95,7 @@ class Importer {
};
// console.log("journalInfo", journalInfo);
await Journal.create(this.client, journalInfo);
await Journal.makeMultilingual(this.client, journalSlug);
}
//Collect issue info

View File

@ -5,7 +5,8 @@ module.exports = {
},
journal: {
getAll: 'index/$$$call$$$/grid/admin/journal/journal-grid/fetch-grid',
create: 'index/$$$call$$$/grid/admin/journal/journal-grid/update-context'
create: 'index/$$$call$$$/grid/admin/journal/journal-grid/update-context',
languageSettings: '$$$call$$$/grid/settings/languages/manage-language-grid/save-language-setting'
},
issue: {
getAll: '$$$call$$$/grid/issues/future-issue-grid/fetch-grid',

View File

@ -1,4 +1,11 @@
module.exports = {
journal: {
addEnglishForms: {
rowId: 'en_US',
setting: 'supportedSubmissionLocales',
value: 1
}
},
submission: {
step1_save: {
'csrfToken': '',

View File

@ -2,6 +2,7 @@ const schema = require("schm");
const translate = require("schm-translate");
const endpoints = require("./endpoints");
const form_data = require("./form-data");
const journalCreateSchema = schema(
{
@ -81,3 +82,20 @@ exports.create_no_validation = async (client, journalInfo = {}) => {
})
.catch(err => console.error("Journal creation failed:", err));
};
exports.makeMultilingual = async (client, journalSlug) => {
journalUrl = client.getJournalUrl(journalSlug);
await client
.send({
baseUrl: journalUrl,
method: "POST",
uri: endpoints.journal.languageSettings,
qs: form_data.journal.addEnglishForms
})
.then(response => {
// TODO Check JSON has certain info ('dataChanged' field)
console.info("Make journal multilingual result:", response.body);
})
.catch(err => console.error("Making journal multilingual failed:", err));
}