Merge pull request #9003 from overleaf/msm-sp-example-project
[web] Example Project for CE/SP GitOrigin-RevId: 6d488ec9f1a37b39f9e345d63fe84557c9a706b6
This commit is contained in:
@@ -31,6 +31,10 @@ const MONTH_NAMES = [
|
||||
'December',
|
||||
]
|
||||
|
||||
const templateProjectDir = Features.hasFeature('saas')
|
||||
? 'example-project'
|
||||
: 'example-project-sp'
|
||||
|
||||
async function createBlankProject(ownerId, projectName, attributes = {}) {
|
||||
const isImport = attributes && attributes.overleaf
|
||||
const project = await _createBlankProject(ownerId, projectName, attributes)
|
||||
@@ -92,14 +96,14 @@ async function createExampleProject(ownerId, projectName) {
|
||||
|
||||
async function _addExampleProjectFiles(ownerId, projectName, project) {
|
||||
const mainDocLines = await _buildTemplate(
|
||||
'example-project/main.tex',
|
||||
`${templateProjectDir}/main.tex`,
|
||||
ownerId,
|
||||
projectName
|
||||
)
|
||||
await _createRootDoc(project, ownerId, mainDocLines)
|
||||
|
||||
const bibDocLines = await _buildTemplate(
|
||||
'example-project/sample.bib',
|
||||
`${templateProjectDir}/sample.bib`,
|
||||
ownerId,
|
||||
projectName
|
||||
)
|
||||
@@ -113,7 +117,7 @@ async function _addExampleProjectFiles(ownerId, projectName, project) {
|
||||
|
||||
const frogPath = path.join(
|
||||
__dirname,
|
||||
'/../../../templates/project_files/example-project/frog.jpg'
|
||||
`/../../../templates/project_files/${templateProjectDir}/frog.jpg`
|
||||
)
|
||||
await ProjectEntityUpdateHandler.promises.addFile(
|
||||
project._id,
|
||||
|
||||
Reference in New Issue
Block a user