mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 07:38:53 +02:00
feat(views/board): add into view type switcher
This commit is contained in:
parent
2384fdbaad
commit
00cc1ffe74
@ -762,7 +762,8 @@
|
|||||||
"invalid_view_type": "Invalid view type '{{type}}'",
|
"invalid_view_type": "Invalid view type '{{type}}'",
|
||||||
"calendar": "Calendar",
|
"calendar": "Calendar",
|
||||||
"table": "Table",
|
"table": "Table",
|
||||||
"geo-map": "Geo Map"
|
"geo-map": "Geo Map",
|
||||||
|
"board": "Board"
|
||||||
},
|
},
|
||||||
"edited_notes": {
|
"edited_notes": {
|
||||||
"no_edited_notes_found": "No edited notes on this day yet...",
|
"no_edited_notes_found": "No edited notes on this day yet...",
|
||||||
|
@ -5,6 +5,16 @@ import type FNote from "../../entities/fnote.js";
|
|||||||
import type { EventData } from "../../components/app_context.js";
|
import type { EventData } from "../../components/app_context.js";
|
||||||
import { bookPropertiesConfig, BookProperty } from "./book_properties_config.js";
|
import { bookPropertiesConfig, BookProperty } from "./book_properties_config.js";
|
||||||
import attributes from "../../services/attributes.js";
|
import attributes from "../../services/attributes.js";
|
||||||
|
import type { ViewTypeOptions } from "../../services/note_list_renderer.js";
|
||||||
|
|
||||||
|
const VIEW_TYPE_MAPPINGS: Record<ViewTypeOptions, string> = {
|
||||||
|
grid: t("book_properties.grid"),
|
||||||
|
list: t("book_properties.list"),
|
||||||
|
calendar: t("book_properties.calendar"),
|
||||||
|
table: t("book_properties.table"),
|
||||||
|
geoMap: t("book_properties.geo-map"),
|
||||||
|
board: t("book_properties.board")
|
||||||
|
};
|
||||||
|
|
||||||
const TPL = /*html*/`
|
const TPL = /*html*/`
|
||||||
<div class="book-properties-widget">
|
<div class="book-properties-widget">
|
||||||
@ -41,11 +51,9 @@ const TPL = /*html*/`
|
|||||||
<span style="white-space: nowrap">${t("book_properties.view_type")}: </span>
|
<span style="white-space: nowrap">${t("book_properties.view_type")}: </span>
|
||||||
|
|
||||||
<select class="view-type-select form-select form-select-sm">
|
<select class="view-type-select form-select form-select-sm">
|
||||||
<option value="grid">${t("book_properties.grid")}</option>
|
${Object.entries(VIEW_TYPE_MAPPINGS).map(([type, label]) => `
|
||||||
<option value="list">${t("book_properties.list")}</option>
|
<option value="${type}">${label}</option>
|
||||||
<option value="calendar">${t("book_properties.calendar")}</option>
|
`).join("")}
|
||||||
<option value="table">${t("book_properties.table")}</option>
|
|
||||||
<option value="geoMap">${t("book_properties.geo-map")}</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -115,7 +123,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!["list", "grid", "calendar", "table", "geoMap"].includes(type)) {
|
if (!VIEW_TYPE_MAPPINGS.hasOwnProperty(type)) {
|
||||||
throw new Error(t("book_properties.invalid_view_type", { type }));
|
throw new Error(t("book_properties.invalid_view_type", { type }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user