vault backup: 2026-08-14 13:25:15
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
date: <% tp.date.now("YYYY-MM-DD") %>
|
date: <% tp.date.now("YYYY-MM-DD") %>
|
||||||
status: proposed
|
status: proposed
|
||||||
owner: Amadou
|
owner: Amadou
|
||||||
|
project:
|
||||||
|
---
|
||||||
---
|
---
|
||||||
|
|
||||||
<%*
|
<%*
|
||||||
@@ -25,31 +27,34 @@ const safeTitle = title
|
|||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// 2. Find available projects for the current year
|
// 2. Find project folders for current year
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
const projectsFolder = `20 Work/Projects/${year}`;
|
const projectsFolder = `20 Work/Projects/${year}`;
|
||||||
|
const projectsRoot = app.vault.getAbstractFileByPath(projectsFolder);
|
||||||
|
|
||||||
const projectFiles = app.vault
|
let projectFolders = [];
|
||||||
.getMarkdownFiles()
|
|
||||||
.filter(file => file.parent?.path === projectsFolder)
|
if (projectsRoot && projectsRoot.children) {
|
||||||
.sort((a, b) => a.basename.localeCompare(b.basename));
|
projectFolders = projectsRoot.children
|
||||||
|
.filter(item => item.children)
|
||||||
|
.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------
|
||||||
|
// 3. Project dropdown
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
// First option allows a decision with no project
|
|
||||||
const projectLabels = [
|
const projectLabels = [
|
||||||
"— No project —",
|
"— No project —",
|
||||||
...projectFiles.map(file => file.basename)
|
...projectFolders.map(folder => folder.name)
|
||||||
];
|
];
|
||||||
|
|
||||||
const projectValues = [
|
const projectValues = [
|
||||||
null,
|
null,
|
||||||
...projectFiles
|
...projectFolders
|
||||||
];
|
];
|
||||||
|
|
||||||
// --------------------------------------------------
|
|
||||||
// 3. Ask which project this decision belongs to
|
|
||||||
// --------------------------------------------------
|
|
||||||
|
|
||||||
const selectedProject = await tp.system.suggester(
|
const selectedProject = await tp.system.suggester(
|
||||||
projectLabels,
|
projectLabels,
|
||||||
projectValues,
|
projectValues,
|
||||||
@@ -57,14 +62,21 @@ const selectedProject = await tp.system.suggester(
|
|||||||
"Related project"
|
"Related project"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Cancelling the modal cancels note creation
|
|
||||||
if (selectedProject === undefined) {
|
if (selectedProject === undefined) {
|
||||||
new Notice("Decision cancelled.");
|
new Notice("Decision cancelled.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const projectName = selectedProject
|
||||||
|
? selectedProject.name
|
||||||
|
: "";
|
||||||
|
|
||||||
|
const projectLink = selectedProject
|
||||||
|
? `[[${projectName}]]`
|
||||||
|
: "";
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// 4. Create Decisions/YYYY/MM folder
|
// 4. Create Decisions/YYYY/MM
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
const baseFolder = "20 Work/Decisions";
|
const baseFolder = "20 Work/Decisions";
|
||||||
@@ -83,58 +95,92 @@ if (!app.vault.getAbstractFileByPath(monthFolder)) {
|
|||||||
// 5. Build filename
|
// 5. Build filename
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
let filename;
|
let filename = `${date} - ${safeTitle}`;
|
||||||
|
|
||||||
if (selectedProject) {
|
if (selectedProject) {
|
||||||
const safeProject = selectedProject.basename
|
const safeProject = projectName
|
||||||
.replace(/[\\/:*?"<>|]/g, "-")
|
.replace(/[\\/:*?"<>|]/g, "-")
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
filename = `${date} - ${safeProject} - ${safeTitle}`;
|
filename = `${date} - ${safeProject} - ${safeTitle}`;
|
||||||
} else {
|
|
||||||
filename = `${date} - ${safeTitle}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// 6. Move + rename note
|
// 6. Move + rename
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
await tp.file.move(
|
await tp.file.move(`${monthFolder}/${filename}`);
|
||||||
`${monthFolder}/${filename}`
|
|
||||||
);
|
|
||||||
|
|
||||||
// Make project available later in the template
|
// --------------------------------------------------
|
||||||
const projectLink = selectedProject
|
// 7. Update Properties AFTER Templater finishes
|
||||||
? `[[${selectedProject.basename}]]`
|
// --------------------------------------------------
|
||||||
: "";
|
|
||||||
|
tp.hooks.on_all_templates_executed(async () => {
|
||||||
|
|
||||||
|
const file = tp.file.find_tfile(
|
||||||
|
`${monthFolder}/${filename}`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
await tp.app.fileManager.processFrontMatter(
|
||||||
|
file,
|
||||||
|
(frontmatter) => {
|
||||||
|
frontmatter.date = date;
|
||||||
|
frontmatter.status = "proposed";
|
||||||
|
frontmatter.owner = "Amadou";
|
||||||
|
frontmatter.project = projectLink;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
-%>
|
-%>
|
||||||
|
|
||||||
> 🟡 **Proposed** · 🟢 **Decided** · 🔴 **Rejected** · ⚫ **Superseded**
|
> 🟡 **Proposed** · 🟢 **Decided** · 🔴 **Rejected** · ⚫ **Superseded**
|
||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
|
Why is a decision needed?
|
||||||
|
|
||||||
<% tp.file.cursor() %>
|
<% tp.file.cursor() %>
|
||||||
|
|
||||||
## Options Considered *(optional)*
|
## Options Considered _(optional)_
|
||||||
|
|
||||||
- **Option 1**
|
### Option 1
|
||||||
- Pros:
|
|
||||||
- Cons:
|
|
||||||
|
|
||||||
- **Option 2**
|
**Description:**
|
||||||
- Pros:
|
|
||||||
- Cons:
|
**Pros:**
|
||||||
|
-
|
||||||
|
|
||||||
|
**Cons:**
|
||||||
|
-
|
||||||
|
|
||||||
|
### Option 2
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
|
||||||
|
**Pros:**
|
||||||
|
-
|
||||||
|
|
||||||
|
**Cons:**
|
||||||
|
-
|
||||||
|
|
||||||
## Decision
|
## Decision
|
||||||
|
|
||||||
|
What was decided?
|
||||||
|
|
||||||
## Why
|
## Why
|
||||||
|
|
||||||
|
Why was this option chosen?
|
||||||
|
|
||||||
-
|
-
|
||||||
|
|
||||||
## Consequences
|
## Consequences
|
||||||
|
|
||||||
|
What are we accepting by making this decision?
|
||||||
|
|
||||||
-
|
-
|
||||||
|
|
||||||
## Related
|
## Related
|
||||||
|
|
||||||
- [[]]
|
<% projectLink ? `- ${projectLink}` : "-" %>
|
||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
date: 2026-08-14
|
||||||
|
status: proposed
|
||||||
|
owner: Amadou
|
||||||
|
project: "[[OTT]]"
|
||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
> 🟡 **Proposed** · 🟢 **Decided** · 🔴 **Rejected** · ⚫ **Superseded**
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
Why is a decision needed?
|
||||||
|
Afin d'éviter toute surprise le jour J de l'émission, nous allons faire un vrai tes
|
||||||
|
|
||||||
|
|
||||||
|
## Options Considered _(optional)_
|
||||||
|
|
||||||
|
### Option 1
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
|
||||||
|
**Pros:**
|
||||||
|
-
|
||||||
|
|
||||||
|
**Cons:**
|
||||||
|
-
|
||||||
|
|
||||||
|
### Option 2
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
|
||||||
|
**Pros:**
|
||||||
|
-
|
||||||
|
|
||||||
|
**Cons:**
|
||||||
|
-
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
What was decided?
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
Why was this option chosen?
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
What are we accepting by making this decision?
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [[OTT]]
|
||||||
Reference in New Issue
Block a user