mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-08-01 12:10:33 +00:00
feat(globalLinkList): improve edit global link dialog to allow adding to tasks from there
This commit is contained in:
parent
2905592b96
commit
2a8bc1ade2
5 changed files with 47 additions and 45 deletions
|
|
@ -2,5 +2,6 @@
|
|||
.custom-icon-wrapper{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<md-dialog aria-label="{{vm.editOrAddStr}} {{vm.globalOrTaskStr}}"
|
||||
<md-dialog aria-label="{{vm.editOrAddStr}} {{vm.getGlobalOrTaskStr()}}"
|
||||
md-theme="vm.theme"
|
||||
class="edit-global-link-dialog">
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools">
|
||||
<h2>{{vm.editOrAddStr}} {{vm.globalOrTaskStr}}</h2>
|
||||
<h2>{{vm.editOrAddStr}} {{vm.getGlobalOrTaskStr()}}</h2>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button"
|
||||
aria-label="Cancel"
|
||||
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
|
||||
<div class="custom-icon-wrapper">
|
||||
<ng-md-icon ng-if="vm.linkCopy.customIcon"
|
||||
icon="{{vm.linkCopy.customIcon}}"></ng-md-icon>
|
||||
<md-autocomplete tabindex="1"
|
||||
md-selected-item="vm.linkCopy.customIcon"
|
||||
md-search-text="vm.searchIconTxt"
|
||||
|
|
@ -53,9 +55,29 @@
|
|||
<span md-highlight-text="vm.searchIconTxt"
|
||||
md-highlight-flags="i">{{icon}}</span>
|
||||
</md-item-template>
|
||||
<md-not-found>
|
||||
No icon found
|
||||
</md-not-found>
|
||||
</md-autocomplete>
|
||||
</div>
|
||||
|
||||
<div ng-if="vm.isNew">
|
||||
<p>Select task to add to (or leave empty to add it to the global link list).</p>
|
||||
<md-autocomplete
|
||||
md-selected-item="vm.selectedTask"
|
||||
md-search-text="vm.searchTaskText"
|
||||
md-items="task in vm.getFilteredTasks(searchTaskText)"
|
||||
md-item-text="task.title"
|
||||
md-min-length="0"
|
||||
placeholder="Select task">
|
||||
<md-item-template>
|
||||
<span md-highlight-text="vm.searchTaskText"
|
||||
md-highlight-flags="^i">{{ task.title }}</span>
|
||||
</md-item-template>
|
||||
<md-not-found>
|
||||
Mo task found
|
||||
</md-not-found>
|
||||
</md-autocomplete>
|
||||
<ng-md-icon ng-if="vm.linkCopy.customIcon"
|
||||
icon="{{vm.linkCopy.customIcon}}"></ng-md-icon>
|
||||
</div>
|
||||
</div>
|
||||
</md-dialog-content>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@
|
|||
let vm = this;
|
||||
|
||||
vm.editOrAddStr = isNew ? 'Add' : 'Edit';
|
||||
vm.globalOrTaskStr = task ? 'link to task' : 'global link';
|
||||
vm.getGlobalOrTaskStr = () => vm.selectedTask ? `link to task "${vm.selectedTask.title}"` : 'global link';
|
||||
|
||||
vm.isNew = isNew;
|
||||
|
||||
vm.customIcons = CUSTOM_ICONS;
|
||||
|
||||
|
|
@ -28,9 +30,10 @@
|
|||
'LINK',
|
||||
'FILE'
|
||||
];
|
||||
vm.task = {};
|
||||
vm.selectedTask = task;
|
||||
vm.theme = theme;
|
||||
vm.linkCopy = angular.copy(link) || {};
|
||||
vm.tasks = Tasks.getTodayAndBacklog();
|
||||
|
||||
if (!vm.linkCopy.type) {
|
||||
vm.linkCopy.type = vm.types[0];
|
||||
|
|
@ -38,8 +41,8 @@
|
|||
|
||||
vm.saveGlobalLink = () => {
|
||||
if (isNew) {
|
||||
if (task) {
|
||||
Tasks.addLocalAttachment(task, link);
|
||||
if (vm.selectedTask) {
|
||||
Tasks.addLocalAttachment(vm.selectedTask, link);
|
||||
} else {
|
||||
GlobalLinkList.addItem(vm.linkCopy);
|
||||
}
|
||||
|
|
@ -57,5 +60,9 @@
|
|||
vm.getFilteredIconSuggestions = (searchText) => {
|
||||
return searchText ? $filter('filter')(vm.customIcons, searchText, false) : vm.customIcons;
|
||||
};
|
||||
|
||||
vm.getFilteredTasks = (searchText) => {
|
||||
return searchText ? $filter('filter')(vm.tasks, searchText, false) : vm.tasks;
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -30,43 +30,8 @@
|
|||
$document[0].onpaste = (ev) => {
|
||||
const link = this.GlobalLinkList.createLinkFromPaste(ev);
|
||||
this.handleLinkinput(link, ev);
|
||||
|
||||
//const log = console.log;
|
||||
//const e = ev;
|
||||
//log('event.clipboardData');
|
||||
//if (e.clipboardData.types) {
|
||||
// log('event.clipboardData.types');
|
||||
//
|
||||
// // Look for a types property that is undefined
|
||||
// if (!Array.isArray(e.clipboardData.types)) {
|
||||
// log('event.clipboardData.types is undefined');
|
||||
// }
|
||||
//
|
||||
// // Loop the data store in type and display it
|
||||
// var i = 0;
|
||||
// while (i < e.clipboardData.types.length) {
|
||||
// var key = e.clipboardData.types[i];
|
||||
// var val = e.clipboardData.getData(key);
|
||||
// log((i + 1) + ': ' + key + ' - ' + val);
|
||||
// i++;
|
||||
// }
|
||||
//
|
||||
//} else {
|
||||
// // Look for access to data if types array is missing
|
||||
// console.log('I am here!');
|
||||
//
|
||||
// var text = e.clipboardData.getData('text/plain');
|
||||
// var url = e.clipboardData.getData('text/uri-list');
|
||||
// var html = e.clipboardData.getData('text/html');
|
||||
// log('text/plain - ' + text);
|
||||
// if (url !== undefined) {
|
||||
// log('text/uri-list - ' + url);
|
||||
// }
|
||||
// if (html !== undefined) {
|
||||
// log('text/html - ' + html);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
// const html = e.clipboardData.getData('text/html');
|
||||
};
|
||||
}
|
||||
|
||||
handleLinkinput(link, ev) {
|
||||
|
|
|
|||
|
|
@ -161,6 +161,13 @@
|
|||
return this.$localStorage.tasks;
|
||||
}
|
||||
|
||||
getTodayAndBacklog() {
|
||||
const todaysT = this.getToday();
|
||||
const backlogT = this.getBacklog();
|
||||
|
||||
return _.concat(todaysT, backlogT);
|
||||
}
|
||||
|
||||
getAllTasks() {
|
||||
const todaysT = this.getToday();
|
||||
const backlogT = this.getBacklog();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue