Commit 7c44bc66 authored by ransome1's avatar ransome1
Browse files

Removed confirmation background click, enhanced file handling

parent 158569e5
{
"name": "sleek",
"productName": "sleek",
"version": "1.1.0-rc.6",
"version": "1.1.0",
"description": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"synopsis": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"category": "ProjectManagement",
......@@ -102,7 +102,7 @@
"pack": "yarn build:css && yarn build:pegjs && electron-builder --dir",
"lint": "eslint --ext .js, src --ext .mjs, src",
"test": "mocha --timeout 10000",
"test1": "mocha ./test/onboarding.js --timeout 10000",
"test1": "mocha ./test/createTodos.js --timeout 10000",
"sass": "sass -w src/scss/style.scss:src/css/style.css",
"start": "yarn sass & electron ."
},
......
name: sleek
base: core18
version: '1.0.9'
version: '1.1.0'
summary: Todo app based on the todo.txt format for Linux, free and open-source
description: |
sleek is an open-source todo app that makes use of the todo.txt format. sleeks GUI is modern and simple but still offers a decent set of functions which help users getting things done. sleek is available as a client for Windows, MacOS and Linux.
......
......@@ -569,6 +569,11 @@
<td><span class="tag is-info is-large">H</span></td>
<td><span class="tag is-info is-large">H</span></td>
</tr>
<tr>
<td id="">Toggle deferred todos</td>
<td><span class="tag is-info is-large">T</span></td>
<td><span class="tag is-info is-large">T</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR8TD1"></td>
<td><span class="tag is-info is-large">B</span></td>
......@@ -599,6 +604,16 @@
<td><span class="tag is-info is-large">.</span></td>
<td><span class="tag is-info is-large">.</span></td>
</tr>
<tr>
<td id="">Print the current view</td>
<td><span class="tag is-info is-large">P</span></td>
<td><span class="tag is-info is-large">P</span></td>
</tr>
<tr>
<td id="">Switch to specific file</td>
<td><span class="tag is-info is-large">1-9</span></td>
<td><span class="tag is-info is-large">1-9</span></td>
</tr>
<tr>
<td id="helpTabKeyboardTR5TD1"></td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">O</span></td>
......@@ -609,6 +624,31 @@
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">C</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">C</span></td>
</tr>
<tr>
<td id="">Show help</td>
<td><span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">?</span></td>
<td><span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">?</span></td>
</tr>
<tr>
<td id="">Switch to next file</td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
</tr>
<tr>
<td id="">Switch to previous file</td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-dark is-large">Shift</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">Tab</span></td>
</tr>
<tr>
<td id="">Close tab or window (when there is only one tab)</td>
<td><span class="tag is-dark is-large">Ctrl</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">W</span></td>
<td><span class="tag is-dark is-large">cmd</span> <i class="fas fa-plus"></i>&nbsp;<span class="tag is-info is-large">W</span></td>
</tr>
<tr>
<th colspan="3"><h5 class="title is-5" style="margin-top: .75em;" id="helpTabKeyboardSubtitle"></h5></th>
</tr>
......
......@@ -15,8 +15,7 @@ const modalFormAlert = document.getElementById("modalFormAlert");
const modalForm = document.getElementById("modalForm");
const modalFormInputLabel = document.getElementById("modalFormInputLabel");
const modalFormInputResize = document.getElementById("modalFormInputResize");
const modalBackground = document.querySelectorAll('.modal-background');
const modalClose = document.querySelectorAll('.close');
const priorityPicker = document.getElementById("priorityPicker");
const btnSave = document.getElementById("btnSave");
const btnItemStatus = document.getElementById("btnItemStatus");
......@@ -85,40 +84,6 @@ priorityPicker.onfocus = function() {
autoCompleteContainer.classList.remove("is-active");
};
modalBackground.forEach(function(el) {
el.onclick = function() {
const modalObject = document.getElementById(el.parentElement.id);
// if modal is modalForm and input is equal the data item
if(modalObject.id === "modalForm" && modalForm.getAttribute("data-item") !== modalFormInput.value) {
getConfirmation(resetModal, translations.modalBackgroundAttention, modalObject);
} else {
resetModal(modalObject).then(function(result) {
console.log(result);
}).catch(function(error) {
handleError(error);
});
}
// trigger matomo event
if(userData.matomoEvents) _paq.push(["trackEvent", "Modal", "Click on Background"]);
}
});
modalClose.forEach(function(el) {
el.onclick = function() {
if(el.getAttribute("data-message")) {
// persist closed message, so it won't show again
if(!userData.dismissedMessages.includes(el.getAttribute("data-message"))) userData.dismissedMessages.push(el.getAttribute("data-message"))
setUserData("dismissedMessages", userData.dismissedMessages);
// trigger matomo event
if(userData.matomoEvents) _paq.push(["trackEvent", "Message", "Click on Close"]);
} else {
// trigger matomo event
if(userData.matomoEvents) _paq.push(["trackEvent", "Modal", "Click on Close"]);
}
el.parentElement.parentElement.classList.remove("is-active");
}
});
// TODO add try catch
function keyUp() {
// do not show suggestion container if Escape has been pressed
......
......@@ -103,7 +103,7 @@
"settingsTabAboutCopyrightLicenseBody": "Copyright (c) 2021 Robin Ahle. sleek ist unter der <a href=\"https://opensource.org/licenses/MIT\" target=\"_blank\">MIT Lizenz</a> verfügbar. Alle Lizenzinformationen sind unter <a href=\"https://github.com/ransome1/sleek/blob/master/LICENSE\" target=\"_blank\">LICENSE</a> einzusehen.",
"settingsTabAboutExternalLibraries": "Eingesetzte Software, die nicht von mir stammt",
"settingsTabAboutPrivacy": "Datenschutzerklärung",
"settingsTabAboutPrivacyBody": "Ich interessiere mich nicht dafür wer sleek Nutzer sind und erhebe daher keine unnötigen Daten. Dennoch möchte ich wissen, wieviele Nutzer sleek aktiv nutzen und, wenn Nutzer ausdrücklich zustimmen, wie sleek genutzt wird. Alle Daten werden anonymisiert, bevor sie an eine durch mich selbst betriebene Matomo-Instanz übertragen werden. Dies geschieht ausschließlich SSL-verschlüsselt. Weitere Details können in der <a href=\"https://github.com/ransome1/sleek/blob/master/PRIVACY.md\" target=\"_blank\">Datenschutzerklärung</a> abgerufen werden.",
"settingsTabAboutPrivacyBody": "Ich interessiere mich nicht dafür wer sleek's Nutzer sind und erhebe daher keine unnötigen Daten. Dennoch möchte ich wissen, wieviele Nutzer sleek aktiv nutzen und, wenn Nutzer ausdrücklich zustimmen, wie sleek genutzt wird. Alle Daten werden anonymisiert, bevor sie an eine durch mich selbst betriebene Matomo-Instanz übertragen werden. Dies geschieht ausschließlich SSL-verschlüsselt. Weitere Details können in der <a href=\"https://github.com/ransome1/sleek/blob/master/PRIVACY.md\" target=\"_blank\">Datenschutzerklärung</a> abgerufen werden.",
"settingsTabSettingsArchive": "Aufgaben archivieren",
"settingsTabSettingsArchiveBody": "Erledigte Aufgaben werden aus der todo.txt-Datei entfernt und in eine done.txt-Datei eingefügt. Diese wird im gleichen Ordner angelegt, falls sie noch nicht existiert.",
"settingsTabSettingsDarkmodeBody": "Wenn sleeks Darstellung generell oder lediglich in der aktuellen Umgebung zu hell ist, kann der Nachtmodus eine hilfreiche Alternative sein.",
......
......@@ -434,22 +434,28 @@ const createWindow = async function() {
footer: "Footer of the Page"
}
mainWindow.webContents.executeJavaScript("body.classList.remove(\"dark\");");
getContent(userData.data.file).then(content => {
mainWindow.webContents.send("refresh", [content, false, true]);
mainWindow.webContents.print(options, (success, error) => {
if(!success) {
console.log(error);
// trigger matomo event
if(userData.data.matomoEvents) _paq.push(["trackEvent", "Print", "Print error", error])
} else {
console.log("Success: Print initiated");
// trigger matomo event
if(userData.data.matomoEvents) _paq.push(["trackEvent", "Print", "Print initiated"])
}
const index = userData.data.files.findIndex(file => file[0] === 1);
if(index!==-1) {
getContent(userData.data.files[index][1]).then(content => {
mainWindow.webContents.send("refresh", [content, false, true]);
mainWindow.webContents.print(options, (success, error) => {
if(!success) {
console.log(error);
// trigger matomo event
if(userData.data.matomoEvents) _paq.push(["trackEvent", "Print", "Print error", error])
} else {
console.log("Success: Print initiated");
// trigger matomo event
if(userData.data.matomoEvents) _paq.push(["trackEvent", "Print", "Print initiated"])
}
});
}).catch(error => {
console.log(error);
});
}).catch(error => {
console.log(error);
});
} else {
console.log("Info: No todo file active, won't print");
return false;
}
}
},
{ type: "separator" },
......
......@@ -58,6 +58,8 @@ const modalPrompt = document.getElementById("modalPrompt");
const modalPromptContent = document.getElementById("modalPromptContent");
const modalPromptConfirm = document.getElementById("modalPromptConfirm");
const modalPromptCancel = document.getElementById("modalPromptCancel");
const modalBackground = document.querySelectorAll('.modal-background');
const modalClose = document.querySelectorAll('.close');
let
a0,
......@@ -378,6 +380,39 @@ function registerEvents() {
errorContainerClose.onclick = function() {
this.parentElement.classList.remove("is-active")
}
modalBackground.forEach(function(el) {
el.onclick = function() {
const modalObject = document.getElementById(el.parentElement.id);
if(modalObject.id==="modalPrompt") return false;
// if modal is modalForm and input is equal the data item
if(modalObject.id === "modalForm" && modalForm.getAttribute("data-item") !== modalFormInput.value) {
getConfirmation(resetModal, translations.modalBackgroundAttention, modalObject);
} else {
resetModal(modalObject).then(function(result) {
console.log(result);
}).catch(function(error) {
handleError(error);
});
}
// trigger matomo event
if(userData.matomoEvents) _paq.push(["trackEvent", "Modal", "Click on Background"]);
}
});
modalClose.forEach(function(el) {
el.onclick = function() {
if(el.getAttribute("data-message")) {
// persist closed message, so it won't show again
if(!userData.dismissedMessages.includes(el.getAttribute("data-message"))) userData.dismissedMessages.push(el.getAttribute("data-message"))
setUserData("dismissedMessages", userData.dismissedMessages);
// trigger matomo event
if(userData.matomoEvents) _paq.push(["trackEvent", "Message", "Click on Close"]);
} else {
// trigger matomo event
if(userData.matomoEvents) _paq.push(["trackEvent", "Modal", "Click on Close"]);
}
el.parentElement.parentElement.classList.remove("is-active");
}
});
return Promise.resolve("Success: Events registered");
} catch(error) {
error.functionName = registerEvents.name;
......@@ -779,8 +814,11 @@ async function startBuilding(append, loadAll) {
function getActiveFile() {
const index = userData.files.findIndex(file => file[0] === 1);
const file = userData.files[index][1];
return file;
if(index!==-1) {
const file = userData.files[index][1];
return file;
}
return false;
}
window.onload = async function () {
......@@ -793,7 +831,7 @@ window.onload = async function () {
drawer = await import("./js/drawer.mjs");
files = await import("./js/files.mjs");
//TODO: Refactoring
if(userData.files && userData.files.length > 0) {
if(userData.files && userData.files.length > 0 && getActiveFile()) {
window.api.send("startFileWatcher", [getActiveFile(), 0]);
} else {
showOnboarding(true).then(function(response) {
......
......@@ -7,3 +7,4 @@ x 2021-07-05 2021-07-05 test todo
x 2021-07-15 2021-07-15 test todo
x 2021-07-17 2021-07-17 test todo
x 2021-07-25 2021-07-25 test todo
x 2021-07-27 2021-07-27 test todo
{"theme":"light","width":1538,"height":863,"horizontal":46,"vertical":217,"maximizeWindow":false,"notifications":true,"useTextarea":false,"compactView":false,"matomoEvents":false,"drawerWidth":"500","showDueIsPast":true,"showDueIsFuture":true,"showDueIsToday":true,"showHidden":false,"showCompleted":true,"sortCompletedLast":false,"sortBy":["priority","dueString","contexts","projects"],"zoom":"100","tray":false,"showEmptyFilters":true,"dismissedNotifications":[-1319247018],"dismissedMessages":[],"hideFilterCategories":[],"language":"en","uid":"TESTING","path":"test/preferences_empty/todo.txt","files":[[1,"test/preferences_empty/todo.txt"]],"file":"test/preferences_empty/todo.txt","filterDrawer":false,"selectedFilters":[],"viewDrawer":false,"sortByLevel":["priority","dueString","contexts","projects"],"deferredTodos":true,"fileTabs":true}
\ No newline at end of file
{"theme":"light","width":1538,"height":863,"horizontal":145,"vertical":548,"maximizeWindow":false,"notifications":true,"useTextarea":false,"compactView":false,"matomoEvents":false,"drawerWidth":"500","showDueIsPast":true,"showDueIsFuture":true,"showDueIsToday":true,"showHidden":false,"showCompleted":true,"sortCompletedLast":false,"sortBy":["priority","dueString","contexts","projects"],"zoom":"100","tray":false,"showEmptyFilters":true,"dismissedNotifications":[-1319247018],"dismissedMessages":[],"hideFilterCategories":[],"language":"en","uid":"TESTING","path":"test/preferences_empty/todo.txt","files":[[1,"test/preferences_empty/todo.txt"]],"file":"test/preferences_empty/todo.txt","filterDrawer":false,"selectedFilters":[],"viewDrawer":false,"sortByLevel":["priority","dueString","contexts","projects"],"deferredTodos":true,"fileTabs":true}
\ No newline at end of file
{"theme":"light","width":1100,"height":700,"horizontal":129,"vertical":670,"maximizeWindow":false,"notifications":true,"useTextarea":false,"compactView":false,"matomoEvents":false,"drawerWidth":"500","showDueIsPast":true,"showDueIsFuture":true,"showDueIsToday":true,"showHidden":false,"showCompleted":true,"sortCompletedLast":false,"sortBy":["priority","dueString","contexts","projects"],"zoom":"100","tray":false,"showEmptyFilters":true,"hideFilterCategories":[],"language":"en","dismissedNotifications":[],"dismissedMessages":[],"sortByLevel":["priority","dueString","contexts","projects"],"deferredTodos":true,"fileTabs":true}
\ No newline at end of file
{"theme":"light","width":1100,"height":700,"horizontal":129,"vertical":525,"maximizeWindow":false,"notifications":true,"useTextarea":false,"compactView":false,"matomoEvents":false,"drawerWidth":"500","showDueIsPast":true,"showDueIsFuture":true,"showDueIsToday":true,"showHidden":false,"showCompleted":true,"sortCompletedLast":false,"sortBy":["priority","dueString","contexts","projects"],"zoom":"100","tray":false,"showEmptyFilters":true,"hideFilterCategories":[],"language":"en","dismissedNotifications":[],"dismissedMessages":[],"sortByLevel":["priority","dueString","contexts","projects"],"deferredTodos":true,"fileTabs":true}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment