diff --git a/public/js/admin/submission-modal-enhanced.js b/public/js/admin/submission-modal-enhanced.js index a60654c9..7d3dbbd6 100644 --- a/public/js/admin/submission-modal-enhanced.js +++ b/public/js/admin/submission-modal-enhanced.js @@ -441,7 +441,93 @@ function renderPublicationRequirements(publicationId) { } /** - * Helper: Render document editor + * Helper: Render multilingual document editor + * Supports multiple language versions with translation + */ +function renderMultilingualDocument(docType, title, submission, article, isStandalone) { + const doc = submission.documents?.[docType] || {}; + const versions = doc.versions || []; + const primaryLang = doc.primaryLanguage || 'en'; + + // Get English and French versions + const enVersion = versions.find(v => v.language === 'en'); + const frVersion = versions.find(v => v.language === 'fr'); + + // For main article, use blog content as English version if no submission version exists + let enContent = enVersion?.content || ''; + if (docType === 'mainArticle' && !enContent && article?.content) { + enContent = article.content; + } + + const frContent = frVersion?.content || ''; + + const enWordCount = enContent ? enContent.split(/\s+/).filter(w => w.length > 0).length : 0; + const frWordCount = frContent ? frContent.split(/\s+/).filter(w => w.length > 0).length : 0; + + const readonly = docType === 'mainArticle' && !isStandalone && article; + + return ` +
🔒 Linked from blog post - edit the blog post to change this content
' : ''} +Translated by: ${frVersion.translatedBy}${frVersion.approved ? ' ✓ Approved' : ''}
` : ''} +