Skip to content

Instantly share code, notes, and snippets.

@kdomanski
Created July 8, 2022 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdomanski/005808092b7de1d609d04311bd0acaa0 to your computer and use it in GitHub Desktop.
Save kdomanski/005808092b7de1d609d04311bd0acaa0 to your computer and use it in GitHub Desktop.
const {createYamlProperty} = this.app.plugins.plugins["metaedit"].api;
const {createButton} = app.plugins.plugins["buttons"];

const buttonMaker = (pn, fpath) => {
    const btn = this.container.createEl('button', {"text": "Done!"});
    const file = this.app.vault.getAbstractFileByPath(fpath)
    btn.addEventListener('click', async (evt) => {    

        evt.preventDefault();
        const d = new Date(Date.now());
        await createYamlProperty(pn, d.toISOString(), fpath);
    });
    return btn;
};

dv.table(
	['Note Name', 'Last review date', ''],
	dv.pages().sort(b => b["reviewdate"], "asc").map(b => [
		b.file.link,
		dv.date(b["reviewdate"]),
		buttonMaker('reviewdate', b.file.path)
	])
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment