Commit 24530c7f authored by ransome1's avatar ransome1
Browse files

Added prototype for prefilling input with selected filter

Optimised datepicker behavior
Updated README.md
parent 45ff6780
# sleek
## Help wanted
Amazing feature requests, major and minor bug reports are piling up, and great discussions are ongoing. I want to thank you for supporting this project. But I also need to admit that I'm overwhelmed by the sheer amount of work. Please understand that sleek is FOSS and I'm not aiming to earn money with it, so my time on the project is limited. If you are skilled in HTML, CSS, JavaScript, the Electron framework, writing Playwright test cases, improving UX/UI or if you're able to maintain sleek for one of the distribution channels, please check in with me <a href="https://github.com/ransome1/sleek/discussions/388">here</a> or check the <a href="https://github.com/ransome1/sleek/issues">issue list</a> and start working on bugs and feature requests.
## 🚨 Help wanted 🚨
Amazing feature requests, major and minor bug reports are piling up, and great discussions are ongoing. I want to thank you for supporting this project. But I also need to admit that I'm overwhelmed by the sheer amount of work. Please understand that sleek is FOSS and I'm not aiming to earn money with it, so my time on the project is limited. If you are skilled in `HTML, CSS, JavaScript, the Electron framework, writing Playwright test cases, improving UX/UI or if you're able to maintain sleek for one of the distribution channels`, please check in with me <a href="https://github.com/ransome1/sleek/discussions/388">here</a> or check the <a href="https://github.com/ransome1/sleek/issues">issue list</a> and start working on bugs and feature requests.
## sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. It's available for Windows, MacOS and Linux
+ [Screenshots](#screenshots)
+ [Development](#development)
+ [Support sleek](#support-sleek)
+ [Sponsor sleek's development](#Sponsor-sleek's-development)
+ [Sponsor sleek](#sponsor-sleek)
+ [Get it from Mac App Store](#get-sleek-from-apple-mac-app-store)
+ [Get it from Microsoft Store](#get-sleek-from-microsoft-store)
+ [Get it from Snap Store](#get-sleek-from-snap-store)
......@@ -15,7 +16,6 @@ Amazing feature requests, major and minor bug reports are piling up, and great d
+ [Get it from Arch User Repository](#get-sleek-from-arch-user-repository)
+ [Download it](#download-sleek)
+ [Build it from source code](#build-sleek-from-source-code)
+ [State of development](#sleeks-state-of-development)
+ [Features](#features)
+ [Used libraries](#used-libraries)
......@@ -23,13 +23,13 @@ sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. Stripp
All classic todo.txt attributes are supported and enhanced by additional features. Creating todos is straightforward, and tag-based filtering in tandem with highly customisable grouping and smart full-text search allow for rapid information retrieval. Completed todos can be hidden or archived into separate done.txt files. Easy integration with other todo.txt apps is facilitated by continuously scanning todo.txt files for changes.
sleek is available for Windows, MacOS and Linux, and in several languages. For a detailed list of features, see below.
sleek is available for Windows, MacOS and Linux, and in several languages. For a detailed list of features, see below. Many useful information can be found in <a href="https://github.com/ransome1/sleek/wiki">sleek's wiki</a>.
### Screenshots
![Alt text](assets/screenshots/mac/main.png?raw=true "Screenshot of sleek's todo list view")
![Alt text](assets/screenshots/mac/drawer.png?raw=true "Screenshot of sleek's auto complete function and multi line todo feature")
### sleeks state of development
### Development
A prioritized backlog of new features and known issues as well as an overview on what is being worked on at the moment can be found <a href="https://github.com/ransome1/sleek/projects/2">here</a>.
### Support sleek
......@@ -37,7 +37,7 @@ A prioritized backlog of new features and known issues as well as an overview on
* Review it on <a href="https://apps.apple.com/us/app/sleek-todo-manager/id1614704209" target="blank">Mac App Store</a>, <a href="https://sourceforge.net/projects/sleek/reviews" target="blank">SourceForge</a> or <a href="https://www.microsoft.com/store/apps/9NWM2WXF60KR" target="blank">Windows Store</a>
* <a href="https://github.com/ransome1/sleek/blob/master/CONTRIBUTING.md">Contribute to sleek</a>
### Sponsor sleek's development
### Sponsor sleek
Pushing sleek to Apple's and Micosoft's app stores creates anual costs. You can support me by covering these costs and <a href="https://github.com/sponsors/ransome1">sponsor me</a>.
### Get sleek from Apple Mac App Store
......@@ -141,4 +141,4 @@ A more detailed documentation can be found in <a href="https://github.com/ransom
- PEG.js: https://github.com/pegjs/pegjs
- Playwright: https://github.com/microsoft/playwright
- Sass: https://github.com/sass/sass
- eslint: https://github.com/eslint/eslint
- eslint: https://github.com/eslint/eslint
\ No newline at end of file
{
"name": "sleek",
"productName": "sleek",
"version": "1.2.9",
"version": "1.3.0-rc.1",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"category": "ProjectManagement",
......
......@@ -20,7 +20,6 @@ Object.assign(Datepicker.locales, de, it, es, fr);
const datePickerInput = document.getElementById("datePickerInput");
const datePickerResult = document.getElementById("datePickerResult");
const dateTypes = ["due", "t"];
datePickerResult.innerHTML = translations.dueDate;
let
......@@ -42,9 +41,10 @@ let
};
function fillDatePickerInput(todo) {
//modalFormInput = document.getElementById("modalFormInput");
// empty it
datePickerResult.innerHTML = "";
const dateTypes = ["due", "t"];
dateTypes.forEach(function(type) {
if(!todo[type]) return false;
datePickerResult.innerHTML += `<span class="prefix">${type}:</span>${todo[type + "String"]}&nbsp;`;
......@@ -52,9 +52,6 @@ function fillDatePickerInput(todo) {
// if it's still empty fill it with placeholder text
if(datePickerResult.innerHTML === "") datePickerResult.innerHTML = translations.formSelectDueDate;
// write date into input element
//modalFormInput.value = todo.toString();
// put focus on input field
document.getElementById("modalFormInput").focus();
......@@ -124,9 +121,8 @@ async function createDatepickerInstance(attachToElement, addDateToElement, exten
// create datepicker instance
// ******************************************************
//(todo.due) ? datePickerOptions.defaultViewDate = todo.due : datePickerOptions.defaultViewDate = undefined
datePicker = await new Datepicker(attachToElement, datePickerOptions);
if(todo.due) datePicker.setDate(todo.due);
// close datepicker when container loses focus
attachToElement.onblur = function() { datePicker.destroy(); }
......@@ -157,16 +153,16 @@ async function createDatepickerInstance(attachToElement, addDateToElement, exten
datepickerContainer.insertBefore(header, firstChild);
dueButton.addEventListener("click", function(event) {
event.stopPropagation();
//(todo.due) ? datePicker.setDate(todo.due) : datePicker.setDate({ clear: true })
datePicker.setDate();
if(todo.due) datePicker.setDate(todo.due);
this.classList.add("is-active");
tabs[1].classList.remove("is-active");
extension = "due";
});
thresholdButton.addEventListener("click", function(event) {
event.stopPropagation();
//(todo.t) ? datePicker.setDate(todo.t) : datePicker.setDate({ clear: true })
datePicker.setDate();
if(todo.t) datePicker.setDate(todo.t);
this.classList.add("is-active");
tabs[0].classList.remove("is-active");
extension = "t";
......@@ -174,21 +170,21 @@ async function createDatepickerInstance(attachToElement, addDateToElement, exten
// intercept the clear button event
const clearButton = datepickerContainer.querySelector(".clear-btn");
clearButton.onclick = function(event) {
clearButton.addEventListener("click", function(event) {
event.stopImmediatePropagation();
delete todo[extension];
delete todo[extension + "String"];
applyDate(todo, addDateToElement);
}
});
attachToElement.addEventListener("changeDate", function(event) {
// ******************************************************
// add due date to todo object or remove a given one if no date is passed
// ******************************************************
datepickerContainer.addEventListener("click", async function(event) {
if(!event.target.classList.contains("datepicker-cell")) return false;
//if(event.target.indexOf(".datepicker-cell.day.selected.focused")) console.log(true);
const date = datePicker.getDate();
//const date = datePicker.getDate();
const date = await datePicker.getDate();
// fill in due date
if(date) {
todo[extension] = date;
todo[extension + "String"] = convertDate(date);
......
......@@ -430,6 +430,21 @@ function resetForm() {
}
}
function preFillInput(selectedFilters) {
let returnString = "";
const prefixes = {
"projects": "+",
"contexts": "@"
}
JSON.parse(selectedFilters).forEach(function(filter) {
if(!prefixes[filter[1]]) return false;
returnString += " ";
returnString += prefixes[filter[1]];
returnString += filter[0];
})
return returnString;
}
async function show(todo, templated) {
try {
......@@ -489,6 +504,14 @@ async function show(todo, templated) {
// if so we paste it into the input field
if(todo.due || todo.t) fillDatePickerInput(todo)
} else {
const value = (userData.selectedFilters.length > 0) ? preFillInput(userData.selectedFilters) : "";
// if textarea is being used replace invisible multiline ascii character with new line
(userData.useTextarea) ? modalFormInput.value = value.replaceAll(String.fromCharCode(16),"\r\n") : modalFormInput.value = value;
modalFormInput.setSelectionRange(0, 0);
}
// resize all necessary input elements
......
Supports Markdown
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