Skip to content

Commit

Permalink
feat: Add a new keyboard shortcut for linking an attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
prilr committed Aug 24, 2024
1 parent b1a1d18 commit 967f020
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/app/features/config/default-global-config.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const DEFAULT_GLOBAL_CONFIG: GlobalConfigState = {
taskSchedule: 's',
taskToggleDone: 'd',
taskAddSubTask: 'a',
taskAddAttachment: 'l',
taskDelete: 'Backspace',
taskMoveToProject: 'e',
taskOpenContextMenu: 'q',
Expand Down
7 changes: 7 additions & 0 deletions src/app/features/config/form-cfgs/keyboard-form.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ export const KEYBOARD_SETTINGS_FORM_CFG: ConfigFormSection<KeyboardConfig> = {
label: T.GCF.KEYBOARD.TASK_ADD_SUB_TASK,
},
},
{
key: 'taskAddAttachment',
type: 'keyboard',
templateOptions: {
label: T.GCF.KEYBOARD.TASK_ADD_ATTACHMENT,
},
},
{
key: 'taskDelete',
type: 'keyboard',
Expand Down
1 change: 1 addition & 0 deletions src/app/features/config/keyboard-config.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type KeyboardConfig = Readonly<{
taskOpenEstimationDialog: string | null;
taskToggleDone: string | null;
taskAddSubTask: string | null;
taskAddAttachment: string | null;
taskMoveToProject: string | null;
taskOpenContextMenu: string | null;
taskDelete: string | null;
Expand Down
1 change: 1 addition & 0 deletions src/app/features/shepherd/shepherd-steps.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ export const SHEPHERD_STEPS = (
<li>${KEY_COMBO('taskDelete')}: Delete Task</li>
<li>${KEY_COMBO('taskToggleDone')}: Toggle done</li>
<li>${KEY_COMBO('taskAddSubTask')}: Add new sub task</li>
<li>${KEY_COMBO('taskAddAttachment')}: Attach a file or link to the task</li>
<li>${KEY_COMBO('togglePlay')}: Toggle tracking</li>
</ul>
Expand Down
7 changes: 5 additions & 2 deletions src/app/features/tasks/task/task.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,11 @@
class="hide-xs"
mat-menu-item
>
<mat-icon>attachment</mat-icon>
{{ T.F.TASK.CMP.OPEN_ATTACH|translate }}
<span class="menuItemLeft">
<mat-icon>attachment</mat-icon>
{{ T.F.TASK.CMP.OPEN_ATTACH|translate }}
</span>
<span class="key-i">{{ kb.taskAddAttachment }}</span>
</button>

<!--TODO maybe handle dynamically -->
Expand Down
3 changes: 3 additions & 0 deletions src/app/features/tasks/task/task.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,9 @@ export class TaskComponent implements OnInit, OnDestroy, AfterViewInit {
if (checkKeyCombo(ev, keys.taskAddSubTask)) {
this.addSubTask();
}
if (checkKeyCombo(ev, keys.taskAddAttachment)) {
this.addAttachment();
}
if (!this.task.parentId && checkKeyCombo(ev, keys.taskMoveToProject)) {
if (!this.projectMenuTrigger) {
throw new Error('No el');
Expand Down
1 change: 1 addition & 0 deletions src/app/t.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,7 @@ const T = {
SHOW_SEARCH_BAR: 'GCF.KEYBOARD.SHOW_SEARCH_BAR',
SYSTEM_SHORTCUTS: 'GCF.KEYBOARD.SYSTEM_SHORTCUTS',
TASK_ADD_SUB_TASK: 'GCF.KEYBOARD.TASK_ADD_SUB_TASK',
TASK_ADD_ATTACHMENT: 'GCF.KEYBOARD.TASK_ADD_ATTACHMENT',
TASK_DELETE: 'GCF.KEYBOARD.TASK_DELETE',
TASK_EDIT_TAGS: 'GCF.KEYBOARD.TASK_EDIT_TAGS',
TASK_EDIT_TITLE: 'GCF.KEYBOARD.TASK_EDIT_TITLE',
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,7 @@
"SHOW_SEARCH_BAR": "Show search bar",
"SYSTEM_SHORTCUTS": "Global Shortcuts (system wide)",
"TASK_ADD_SUB_TASK": "Add sub Task",
"TASK_ADD_ATTACHMENT": "Attach file or link",
"TASK_DELETE": "Delete Task",
"TASK_EDIT_TAGS": "Edit Tags",
"TASK_EDIT_TITLE": "Edit Title",
Expand Down

0 comments on commit 967f020

Please sign in to comment.