Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions assets/scripts/actions/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const createPage = (
content: string,
title: string,
index: number,
inMenu: boolean = true
): ReturnType<typeof writeFileAndPushChanges> => {
const { state } = store
const fileName = makeFileNameFromTitle(title)
Expand All @@ -77,7 +78,7 @@ export const createPage = (
store.mutations.setPages(newPages)

const finalContent = `${
title ? makePageFrontMatter(title, index) + '\n' : ''
title ? makePageFrontMatter(title, index, inMenu) + '\n' : ''
}${content} `

return writeFileAndPushChanges(
Expand All @@ -92,6 +93,7 @@ export const updatePage = async (
title: string,
content: string,
index: number,
inMenu: boolean,
blogIndex: boolean,
): ReturnType<typeof writeFileAndPushChanges> => {
const { gitAgent } = store.state
Expand All @@ -112,7 +114,7 @@ export const updatePage = async (
}

const finalContent = `${
title ? makePageFrontMatter(title, index, undefined, blogIndex) + '\n' : ''
title ? makePageFrontMatter(title, index, inMenu, blogIndex) + '\n' : ''
}${content} `

return writeFileAndPushChanges(
Expand Down
1 change: 1 addition & 0 deletions assets/scripts/components/screens/intern/Editeur.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
// parent component should be responsible for awaiting the promise and
// displaying a loading screen.
fileP.then(_file => {
console.log('fileP', _file)
file = _file
})

Expand Down
3 changes: 2 additions & 1 deletion assets/scripts/routes/atelier-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const makeMapStateToProps =
}

try {
await updatePage(fileName, title, content, index, blogIndex)
throw `On a besoin de savoir quelle était la valeur de inMenu pour la fournir`
await updatePage(fileName, title, content, index, inMenu, blogIndex)
setBuildingAndCheckStatusLater(state.currentRepository, state.gitAgent)
page(makeAtelierListPageURL(state.currentRepository))
} catch (msg: any) {
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function makeArticleFileName(title: string, date: Date): string {
export function makePageFrontMatter(
title: string,
index: number | null = 1,
inMenu: boolean = true,
inMenu: boolean, // this function is too low-level to assign a default to inMenu
blogIndex?: boolean,
): string {
return [
Expand Down