Skip to content

Commit 8ceaa36

Browse files
committed
feat: Move id and blockedBy fields to after the description
From using these fields in my own vault, it feels like a bit more natural of an order. I especially wanted id to come before blockedBy, as the pattern looks better when there is a series of tasks with dependencies in.
1 parent 2008912 commit 8ceaa36

11 files changed

+40
-39
lines changed

β€Ždocs/Scripting/Task Properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ For more information, including adding your own customised statuses, see [[Statu
142142
| `task.isRecurring` | `boolean` | `true` | `boolean` | `false` |
143143
| `task.recurrenceRule` | `string` | `'every day when done'` | `string` | `''` |
144144
| `task.tags` | `string[]` | `['#todo', '#health']` | `any[]` | `[]` |
145-
| `task.originalMarkdown` | `string` | `' - [ ] Do exercises #todo #health πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ⛔️ 123456,abc123 πŸ†” abcdef ^dcf64c'` | `string` | `'- [/] minimal task'` |
145+
| `task.originalMarkdown` | `string` | `' - [ ] Do exercises #todo #health πŸ†” abcdef ⛔️ 123456,abc123 πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ^dcf64c'` | `string` | `'- [/] minimal task'` |
146146

147147
<!-- placeholder to force blank line after included text --><!-- endInclude -->
148148

β€Žresources/sample_vaults/Tasks-Demo/Manual Testing/Dependencies Samples.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Dependencies Samples
22

33
- [ ] #task Choose a topic πŸ†” ya44g5
4-
- [ ] #task Research the subject ⛔️ ya44g5 πŸ†” g7317o
5-
- [ ] #task Create an outline ⛔️ g7317o πŸ†” rot7gb
6-
- [ ] #task Develop main points ⛔️ rot7gb πŸ†” mvplec
7-
- [ ] #task Craft a conclusion ⛔️ mvplec πŸ†” 0wigip
8-
- [ ] #task Proofread and edit ⛔️ 0wigip πŸ†” 5ti6bf
4+
- [ ] #task Research the subject πŸ†” g7317o ⛔️ ya44g5
5+
- [ ] #task Create an outline πŸ†” rot7gb ⛔️ g7317o
6+
- [ ] #task Develop main points πŸ†” mvplec ⛔️ rot7gb
7+
- [ ] #task Craft a conclusion πŸ†” 0wigip ⛔️ mvplec
8+
- [ ] #task Proofread and edit πŸ†” 5ti6bf ⛔️ 0wigip
99
- [ ] #task Publish the article ⛔️ 5ti6bf
1010

1111
---

β€Žsrc/TaskLayout.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ export type TaskLayoutComponent =
1616
| 'id'
1717
| 'blockLink';
1818

19+
// The order here determines the order that task fields are rendered and written to markdown.
1920
export const taskLayoutComponents: TaskLayoutComponent[] = [
2021
// NEW_TASK_FIELD_EDIT_REQUIRED
2122
'description',
23+
'id',
24+
'blockedBy',
2225
'priority',
2326
'recurrenceRule',
2427
'createdDate',
@@ -27,8 +30,6 @@ export const taskLayoutComponents: TaskLayoutComponent[] = [
2730
'dueDate',
2831
'cancelledDate',
2932
'doneDate',
30-
'blockedBy',
31-
'id',
3233
'blockLink',
3334
];
3435

β€Žtests/Layout/TaskLayoutOptions.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ describe('TaskLayoutOptions', () => {
77

88
expect(options.shownComponents.join('\n')).toMatchInlineSnapshot(`
99
"description
10+
id
11+
blockedBy
1012
priority
1113
recurrenceRule
1214
createdDate
@@ -15,8 +17,6 @@ describe('TaskLayoutOptions', () => {
1517
dueDate
1618
cancelledDate
1719
doneDate
18-
blockedBy
19-
id
2020
blockLink"
2121
`);
2222

@@ -62,6 +62,8 @@ describe('TaskLayoutOptions', () => {
6262
const options = new TaskLayoutOptions();
6363
expect(options.shownComponents.join('\n')).toMatchInlineSnapshot(`
6464
"description
65+
id
66+
blockedBy
6567
priority
6668
recurrenceRule
6769
createdDate
@@ -70,8 +72,6 @@ describe('TaskLayoutOptions', () => {
7072
dueDate
7173
cancelledDate
7274
doneDate
73-
blockedBy
74-
id
7575
blockLink"
7676
`);
7777

@@ -80,15 +80,15 @@ describe('TaskLayoutOptions', () => {
8080

8181
expect(options.shownComponents.join('\n')).toMatchInlineSnapshot(`
8282
"description
83+
id
84+
blockedBy
8385
priority
8486
recurrenceRule
8587
createdDate
8688
startDate
8789
scheduledDate
8890
cancelledDate
89-
doneDate
90-
blockedBy
91-
id"
91+
doneDate"
9292
`);
9393
});
9494

@@ -134,16 +134,16 @@ describe('TaskLayoutOptions', () => {
134134
const options = new TaskLayoutOptions();
135135

136136
expect(options.toggleableComponents.join('\n')).toMatchInlineSnapshot(`
137-
"priority
137+
"id
138+
blockedBy
139+
priority
138140
recurrenceRule
139141
createdDate
140142
startDate
141143
scheduledDate
142144
dueDate
143145
cancelledDate
144-
doneDate
145-
blockedBy
146-
id"
146+
doneDate"
147147
`);
148148
});
149149
});

β€Žtests/Scripting/TaskProperties.test.task_other_fields.approved.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| `task.isRecurring` | `boolean` | `true` | `boolean` | `false` |
1212
| `task.recurrenceRule` | `string` | `'every day when done'` | `string` | `''` |
1313
| `task.tags` | `string[]` | `['#todo', '#health']` | `any[]` | `[]` |
14-
| `task.originalMarkdown` | `string` | `' - [ ] Do exercises #todo #health πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ⛔️ 123456,abc123 πŸ†” abcdef ^dcf64c'` | `string` | `'- [/] minimal task'` |
14+
| `task.originalMarkdown` | `string` | `' - [ ] Do exercises #todo #health πŸ†” abcdef ⛔️ 123456,abc123 πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ^dcf64c'` | `string` | `'- [/] minimal task'` |
1515

1616

1717
<!-- placeholder to force blank line after included text -->

β€Žtests/TaskLayout.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ describe('TaskLayout tests', () => {
2626
const taskLayout = new TaskLayout(taskLayoutOptions, queryLayoutOptions);
2727

2828
expect(taskLayout.taskListHiddenClasses().join('\n')).toMatchInlineSnapshot(`
29-
"tasks-layout-hide-priority
29+
"tasks-layout-hide-id
30+
tasks-layout-hide-blockedBy
31+
tasks-layout-hide-priority
3032
tasks-layout-hide-recurrenceRule
3133
tasks-layout-hide-createdDate
3234
tasks-layout-hide-startDate
3335
tasks-layout-hide-scheduledDate
3436
tasks-layout-hide-dueDate
3537
tasks-layout-hide-cancelledDate
3638
tasks-layout-hide-doneDate
37-
tasks-layout-hide-blockedBy
38-
tasks-layout-hide-id
3939
tasks-layout-hide-tags
4040
tasks-layout-hide-backlinks
4141
tasks-layout-hide-edit-button

β€Žtests/TaskLineRenderer.test.Visualise_HTML_Full_task_-_full_mode.approved.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
- [ ] Do exercises #todo #health πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ⛔️ 123456,abc123 πŸ†” abcdef ^dcf64c
2+
- [ ] Do exercises #todo #health πŸ†” abcdef ⛔️ 123456,abc123 πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ^dcf64c
33
-->
44

55
<li class="task-list-item plugin-tasks-list-item"
@@ -18,6 +18,10 @@
1818
<span class="tasks-list-text">
1919
<span class="task-description">
2020
<span>Do exercises #todo #health</span></span>
21+
<span class="task-id">
22+
<span> πŸ†” abcdef</span></span>
23+
<span class="task-blockedBy">
24+
<span> ⛔️ 123456,abc123</span></span>
2125
<span class="task-priority"
2226
data-task-priority="medium">
2327
<span> πŸ”Ό</span></span>
@@ -41,9 +45,5 @@
4145
<span class="task-done"
4246
data-task-done="past-far">
4347
<span> βœ… 2023-07-05</span></span>
44-
<span class="task-blockedBy">
45-
<span> ⛔️ 123456,abc123</span></span>
46-
<span class="task-id">
47-
<span> πŸ†” abcdef</span></span>
4848
<span class="task-block-link">
4949
<span> ^dcf64c</span></span></span></li>

β€Žtests/TaskLineRenderer.test.Visualise_HTML_Full_task_-_short_mode.approved.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
- [ ] Do exercises #todo #health πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ⛔️ 123456,abc123 πŸ†” abcdef ^dcf64c
2+
- [ ] Do exercises #todo #health πŸ†” abcdef ⛔️ 123456,abc123 πŸ”Ό πŸ” every day when done βž• 2023-07-01 πŸ›« 2023-07-02 ⏳ 2023-07-03 πŸ“… 2023-07-04 ❌ 2023-07-06 βœ… 2023-07-05 ^dcf64c
33
-->
44

55
<li class="task-list-item plugin-tasks-list-item"
@@ -18,6 +18,10 @@
1818
<span class="tasks-list-text">
1919
<span class="task-description">
2020
<span>Do exercises #todo #health</span></span>
21+
<span class="task-id">
22+
<span> πŸ†”</span></span>
23+
<span class="task-blockedBy">
24+
<span> ⛔️</span></span>
2125
<span class="task-priority"
2226
data-task-priority="medium">
2327
<span> πŸ”Ό</span></span>
@@ -41,9 +45,5 @@
4145
<span class="task-done"
4246
data-task-done="past-far">
4347
<span> βœ…</span></span>
44-
<span class="task-blockedBy">
45-
<span> ⛔️</span></span>
46-
<span class="task-id">
47-
<span> πŸ†”</span></span>
4848
<span class="task-block-link">
4949
<span> ^dcf64c</span></span></span></li>

β€Žtests/TaskLineRenderer.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ describe('task line rendering - layout options', () => {
202202
await testLayoutOptions(
203203
[
204204
'Do exercises #todo #health',
205+
' πŸ†” abcdef',
206+
' ⛔️ 123456,abc123',
205207
' πŸ”Ό',
206208
' πŸ” every day when done',
207209
' βž• 2023-07-01',
@@ -210,8 +212,6 @@ describe('task line rendering - layout options', () => {
210212
' πŸ“… 2023-07-04',
211213
' ❌ 2023-07-06',
212214
' βœ… 2023-07-05',
213-
' ⛔️ 123456,abc123',
214-
' πŸ†” abcdef',
215215
' ^dcf64c',
216216
],
217217
taskLayoutComponents,
@@ -246,6 +246,8 @@ describe('task line rendering - layout options', () => {
246246
await testLayoutOptions(
247247
[
248248
'Do exercises #todo #health',
249+
' πŸ†” abcdef',
250+
' ⛔️ 123456,abc123',
249251
' πŸ”Ό',
250252
' πŸ” every day when done',
251253
' βž• 2023-07-01',
@@ -254,8 +256,6 @@ describe('task line rendering - layout options', () => {
254256
' πŸ“… 2023-07-04',
255257
' ❌ 2023-07-06',
256258
' βœ… 2023-07-05',
257-
' ⛔️ 123456,abc123',
258-
' πŸ†” abcdef',
259259
' ^dcf64c',
260260
],
261261
taskLayoutComponents,

β€Žtests/TaskSerializer/DataviewTaskSerializer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ describe('DataviewTaskSerializer', () => {
269269
const task = TaskBuilder.createFullyPopulatedTask();
270270
const serialized = serialize(task);
271271
expect(serialized).toMatchInlineSnapshot(
272-
'"Do exercises #todo #health [priority:: medium] [repeat:: every day when done] [created:: 2023-07-01] [start:: 2023-07-02] [scheduled:: 2023-07-03] [due:: 2023-07-04] [cancelled:: 2023-07-06] [completion:: 2023-07-05] [blockedBy:: 123456,abc123] [id:: abcdef] ^dcf64c"',
272+
'"Do exercises #todo #health [id:: abcdef] [blockedBy:: 123456,abc123] [priority:: medium] [repeat:: every day when done] [created:: 2023-07-01] [start:: 2023-07-02] [scheduled:: 2023-07-03] [due:: 2023-07-04] [cancelled:: 2023-07-06] [completion:: 2023-07-05] ^dcf64c"',
273273
);
274274
});
275275
});

0 commit comments

Comments
Β (0)