add #workspaceTemplate which works as workspace-scoped template, closes #3137

This commit is contained in:
zadam 2022-09-16 22:44:52 +02:00
parent 3c49ea6cb1
commit b816773d02
3 changed files with 6 additions and 1 deletions

View File

@ -207,6 +207,7 @@ const ATTR_HELP = {
"workspaceIconClass": "defines box icon CSS class which will be used in tab when hoisted to this note",
"workspaceTabBackgroundColor": "CSS color used in the note tab when hoisted to this note",
"workspaceCalendarRoot": "Defines per-workspace calendar root",
"workspaceTemplate": "This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template",
"searchHome": "new search notes will be created as children of this note",
"hoistedSearchHome": "new search notes will be created as children of this note when hoisted to some ancestor of this note",
"inbox": "default inbox location for new notes",

View File

@ -6,6 +6,7 @@ const log = require('../../services/log');
const scriptService = require('../../services/script');
const searchService = require('../../services/search/services/search');
const bulkActionService = require("../../services/bulk_actions");
const cls = require("../../services/cls");
const {formatAttrForSearch} = require("../../services/attribute_formatter");
function searchFromNoteInt(note) {
@ -189,7 +190,9 @@ function getRelatedNotes(req) {
}
function searchTemplates() {
const query = formatAttrForSearch({type: 'label', name: "template"}, false);
const query = cls.getHoistedNoteId() === 'root'
? '#template'
: '#template OR #workspaceTemplate';
return searchService.searchNotes(query, {
includeArchivedNotes: true,

View File

@ -30,6 +30,7 @@ module.exports = [
{ type: 'label', name: 'workspaceIconClass' },
{ type: 'label', name: 'workspaceTabBackgroundColor' },
{ type: 'label', name: 'workspaceCalendarRoot' },
{ type: 'label', name: 'workspaceTemplate' },
{ type: 'label', name: 'searchHome' },
{ type: 'label', name: 'hoistedInbox' },
{ type: 'label', name: 'hoistedSearchHome' },