refactor: remove default projects functionality

- Remove defaultProjects field from TaskCreationDefaults interface
- Remove default projects UI setting and initialization logic
- Remove {{projects}} template variable support and documentation
- Simplify project system to manual selection only
- Update documentation to reflect manual-only project assignment
This commit is contained in:
Callum Alpass 2025-07-05 19:28:05 +10:00
parent 814520f0d5
commit 10ab36449e
5 changed files with 22 additions and 42 deletions

View file

@ -46,7 +46,7 @@ Tasks can be filtered and grouped by their associated projects in all task views
### Template Integration
Projects support template variables for automated workflows. The `{{projects}}` template variable can be used in task templates, and the `{{parentNote}}` variable will format project links as YAML list items when creating tasks from project notes.
Projects support template variables for automated workflows. The `{{parentNote}}` variable will format project links as YAML list items when creating tasks from project notes.
## File Management and Templates

View file

@ -22,8 +22,8 @@ This feature is recommended for users who prefer a minimalist approach to their
## Default Task Properties
You can set the **Default Status** and **Default Priority** for new tasks, as well as the **Default Due Date** and **Default Scheduled Date**. You can also specify default **Contexts**, **Projects**, and **Tags** that will be automatically added to new tasks.
You can set the **Default Status** and **Default Priority** for new tasks, as well as the **Default Due Date** and **Default Scheduled Date**. You can also specify default **Contexts** and **Tags** that will be automatically added to new tasks.
## Template System
TaskNotes supports **Templates** for both the YAML frontmatter and the body of your task notes. You can use templates to pre-fill common values, add boilerplate text, and create a consistent structure for your tasks. Templates can also include variables, such as `{{title}}`, `{{date}}`, `{{parentNote}}`, and `{{projects}}`, which will be automatically replaced with the appropriate values when a new task is created.
TaskNotes supports **Templates** for both the YAML frontmatter and the body of your task notes. You can use templates to pre-fill common values, add boilerplate text, and create a consistent structure for your tasks. Templates can also include variables, such as `{{title}}`, `{{date}}`, and `{{parentNote}}`, which will be automatically replaced with the appropriate values when a new task is created.

View file

@ -249,9 +249,8 @@ export class TaskCreationModal extends TaskModal {
// Apply default scheduled date based on user settings
this.scheduledDate = calculateDefaultDate(defaults.defaultScheduledDate);
// Apply default contexts, projects, and tags
// Apply default contexts and tags
this.contexts = defaults.defaultContexts || '';
this.projects = defaults.defaultProjects || '';
this.tags = defaults.defaultTags || '';
// Apply default time estimate

View file

@ -200,6 +200,24 @@ export abstract class TaskModal extends Modal {
}
protected createAdditionalFields(container: HTMLElement): void {
// Projects - now using note selection instead of text input
new Setting(container)
.setName('Projects')
.addButton(button => {
button.setButtonText('Add Project')
.setTooltip('Select a project note using fuzzy search')
.onClick(() => {
const modal = new ProjectSelectModal(this.app, (file) => {
this.addProject(file);
});
modal.open();
});
});
// Projects list container
this.projectsList = container.createDiv({ cls: 'task-projects-list' });
this.renderProjectsList(); // Initialize empty state
// Contexts input with autocomplete
new Setting(container)
.setName('Contexts')
@ -217,25 +235,6 @@ export abstract class TaskModal extends Modal {
this.setupAutocomplete(text.inputEl, 'contexts');
});
// Projects - now using note selection instead of text input
new Setting(container)
.setName('Projects')
.setDesc('Link to project notes')
.addButton(button => {
button.setButtonText('Add Project')
.setTooltip('Select a project note using fuzzy search')
.onClick(() => {
const modal = new ProjectSelectModal(this.app, (file) => {
this.addProject(file);
});
modal.open();
});
});
// Projects list container
this.projectsList = container.createDiv({ cls: 'task-projects-list' });
this.renderProjectsList(); // Initialize empty state
// Tags input with autocomplete
new Setting(container)
.setName('Tags')
@ -827,8 +826,6 @@ export abstract class TaskModal extends Modal {
this.projectsList.empty();
if (this.selectedProjectFiles.length === 0) {
const emptyState = this.projectsList.createDiv({ cls: 'task-projects-empty' });
emptyState.textContent = 'No projects selected';
return;
}

View file

@ -55,7 +55,6 @@ export interface TaskNotesSettings {
export interface TaskCreationDefaults {
// Pre-fill options
defaultContexts: string; // Comma-separated list
defaultProjects: string; // Comma-separated list
defaultTags: string; // Comma-separated list
defaultTimeEstimate: number; // minutes, 0 = no default
defaultRecurrence: 'none' | 'daily' | 'weekly' | 'monthly' | 'yearly';
@ -188,7 +187,6 @@ export const DEFAULT_PRIORITIES: PriorityConfig[] = [
export const DEFAULT_TASK_CREATION_DEFAULTS: TaskCreationDefaults = {
defaultContexts: '',
defaultProjects: '',
defaultTags: '',
defaultTimeEstimate: 0,
defaultRecurrence: 'none',
@ -683,19 +681,6 @@ export class TaskNotesSettingTab extends PluginSettingTab {
});
});
new Setting(container)
.setName('Default projects')
.setDesc('Default projects for new tasks (comma-separated)')
.addText(text => {
text.inputEl.setAttribute('aria-label', 'Default projects for new tasks');
return text
.setPlaceholder('shopping, learning')
.setValue(this.plugin.settings.taskCreationDefaults.defaultProjects)
.onChange(async (value) => {
this.plugin.settings.taskCreationDefaults.defaultProjects = value;
await this.plugin.saveSettings();
});
});
new Setting(container)
.setName('Default tags')
@ -825,7 +810,6 @@ export class TaskNotesSettingTab extends PluginSettingTab {
helpList.createEl('li', { text: '{{priority}} - Task priority' });
helpList.createEl('li', { text: '{{status}} - Task status' });
helpList.createEl('li', { text: '{{contexts}} - Task contexts' });
helpList.createEl('li', { text: '{{projects}} - Task projects' });
helpList.createEl('li', { text: '{{tags}} - Task tags' });
helpList.createEl('li', { text: '{{timeEstimate}} - Time estimate in minutes' });
helpList.createEl('li', { text: '{{dueDate}} - Task due date' });