vault backup: 2026-08-14 13:25:15
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
date: <% tp.date.now("YYYY-MM-DD") %>
|
||||
status: proposed
|
||||
owner: Amadou
|
||||
project:
|
||||
---
|
||||
---
|
||||
|
||||
<%*
|
||||
@@ -25,31 +27,34 @@ const safeTitle = title
|
||||
.trim();
|
||||
|
||||
// --------------------------------------------------
|
||||
// 2. Find available projects for the current year
|
||||
// 2. Find project folders for current year
|
||||
// --------------------------------------------------
|
||||
|
||||
const projectsFolder = `20 Work/Projects/${year}`;
|
||||
const projectsRoot = app.vault.getAbstractFileByPath(projectsFolder);
|
||||
|
||||
const projectFiles = app.vault
|
||||
.getMarkdownFiles()
|
||||
.filter(file => file.parent?.path === projectsFolder)
|
||||
.sort((a, b) => a.basename.localeCompare(b.basename));
|
||||
let projectFolders = [];
|
||||
|
||||
if (projectsRoot && projectsRoot.children) {
|
||||
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 = [
|
||||
"— No project —",
|
||||
...projectFiles.map(file => file.basename)
|
||||
...projectFolders.map(folder => folder.name)
|
||||
];
|
||||
|
||||
const projectValues = [
|
||||
null,
|
||||
...projectFiles
|
||||
...projectFolders
|
||||
];
|
||||
|
||||
// --------------------------------------------------
|
||||
// 3. Ask which project this decision belongs to
|
||||
// --------------------------------------------------
|
||||
|
||||
const selectedProject = await tp.system.suggester(
|
||||
projectLabels,
|
||||
projectValues,
|
||||
@@ -57,14 +62,21 @@ const selectedProject = await tp.system.suggester(
|
||||
"Related project"
|
||||
);
|
||||
|
||||
// Cancelling the modal cancels note creation
|
||||
if (selectedProject === undefined) {
|
||||
new Notice("Decision cancelled.");
|
||||
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";
|
||||
@@ -83,58 +95,92 @@ if (!app.vault.getAbstractFileByPath(monthFolder)) {
|
||||
// 5. Build filename
|
||||
// --------------------------------------------------
|
||||
|
||||
let filename;
|
||||
let filename = `${date} - ${safeTitle}`;
|
||||
|
||||
if (selectedProject) {
|
||||
const safeProject = selectedProject.basename
|
||||
const safeProject = projectName
|
||||
.replace(/[\\/:*?"<>|]/g, "-")
|
||||
.trim();
|
||||
|
||||
filename = `${date} - ${safeProject} - ${safeTitle}`;
|
||||
} else {
|
||||
filename = `${date} - ${safeTitle}`;
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// 6. Move + rename note
|
||||
// 6. Move + rename
|
||||
// --------------------------------------------------
|
||||
|
||||
await tp.file.move(
|
||||
`${monthFolder}/${filename}`
|
||||
);
|
||||
await tp.file.move(`${monthFolder}/${filename}`);
|
||||
|
||||
// Make project available later in the template
|
||||
const projectLink = selectedProject
|
||||
? `[[${selectedProject.basename}]]`
|
||||
: "";
|
||||
// --------------------------------------------------
|
||||
// 7. Update Properties AFTER Templater finishes
|
||||
// --------------------------------------------------
|
||||
|
||||
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**
|
||||
|
||||
## Context
|
||||
|
||||
Why is a decision needed?
|
||||
|
||||
<% tp.file.cursor() %>
|
||||
|
||||
## Options Considered *(optional)*
|
||||
## Options Considered _(optional)_
|
||||
|
||||
- **Option 1**
|
||||
- Pros:
|
||||
- Cons:
|
||||
### Option 1
|
||||
|
||||
- **Option 2**
|
||||
- Pros:
|
||||
- Cons:
|
||||
**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
|
||||
|
||||
- [[]]
|
||||
<% 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