diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.js b/src/public/app/widgets/attribute_widgets/attribute_detail.js index 2e2c0d013..c11db3d96 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_detail.js +++ b/src/public/app/widgets/attribute_widgets/attribute_detail.js @@ -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", diff --git a/src/routes/api/search.js b/src/routes/api/search.js index 2b00fc607..f07afcefa 100644 --- a/src/routes/api/search.js +++ b/src/routes/api/search.js @@ -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, diff --git a/src/services/builtin_attributes.js b/src/services/builtin_attributes.js index 58e47f842..64b1b1959 100644 --- a/src/services/builtin_attributes.js +++ b/src/services/builtin_attributes.js @@ -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' },