+ 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); // console.log("journalInfo", journalInfo);
await Journal.create(this.client, journalInfo); await Journal.create(this.client, journalInfo);
await Journal.makeMultilingual(this.client, journalSlug);
} }
//Collect issue info //Collect issue info

View File

@ -5,7 +5,8 @@ module.exports = {
}, },
journal: { journal: {
getAll: 'index/$$$call$$$/grid/admin/journal/journal-grid/fetch-grid', 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: { issue: {
getAll: '$$$call$$$/grid/issues/future-issue-grid/fetch-grid', getAll: '$$$call$$$/grid/issues/future-issue-grid/fetch-grid',

View File

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

View File

@ -2,6 +2,7 @@ const schema = require("schm");
const translate = require("schm-translate"); const translate = require("schm-translate");
const endpoints = require("./endpoints"); const endpoints = require("./endpoints");
const form_data = require("./form-data");
const journalCreateSchema = schema( const journalCreateSchema = schema(
{ {
@ -81,3 +82,20 @@ exports.create_no_validation = async (client, journalInfo = {}) => {
}) })
.catch(err => console.error("Journal creation failed:", err)); .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));
}