Commit aff7b358 authored by ransome1's avatar ransome1
Browse files

Fixed for #129, added version number on hover over nav bar

parent 406537ab
{ {
"name": "sleek", "name": "sleek",
"productName": "sleek", "productName": "sleek",
"version": "1.0.9-rc.3", "version": "1.0.9-rc.4",
"description": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source", "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", "synopsis": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"category": "ProjectManagement", "category": "ProjectManagement",
......
...@@ -879,6 +879,7 @@ nav ul { ...@@ -879,6 +879,7 @@ nav ul {
nav ul li a, nav ul li a,
nav ul li.logo { nav ul li.logo {
width: 5em; width: 5em;
position: relative;
display: block; display: block;
height: 5em; height: 5em;
line-height: 5em; line-height: 5em;
...@@ -905,6 +906,22 @@ nav ul:nth-child(2) { ...@@ -905,6 +906,22 @@ nav ul:nth-child(2) {
bottom: 0; bottom: 0;
left: 0; left: 0;
} }
nav ul:nth-child(2) #versionNumber {
width: auto !important;
padding: 0.1em;
line-height: 1em;
display: none;
position: fixed;
bottom: 0.2em;
z-index: 80;
margin-left: 7em;
font-size: 0.8em;
color: #ccc;
background: white !important;
}
nav ul:nth-child(2):hover #versionNumber {
display: flex;
}
#todoTableSearchContainer { #todoTableSearchContainer {
display: none; display: none;
...@@ -958,7 +975,7 @@ nav ul:nth-child(2) { ...@@ -958,7 +975,7 @@ nav ul:nth-child(2) {
top: 0.8em; top: 0.8em;
left: 1.4em; left: 1.4em;
z-index: 70; z-index: 70;
padding: 0.75em 0.75em 0.75em 0; padding: 0.75em 0;
} }
@media screen and (max-width: 992px), screen and (max-height: 650px) { @media screen and (max-width: 992px), screen and (max-height: 650px) {
...@@ -1042,6 +1059,9 @@ nav ul li.logo { ...@@ -1042,6 +1059,9 @@ nav ul li.logo {
height: 3.5em; height: 3.5em;
line-height: 3.5em; line-height: 3.5em;
} }
nav ul:nth-child(2) #versionNumber {
margin-left: 5em;
}
#autoCompleteContainer, #autoCompleteContainer,
#drawerContainer .drawer { #drawerContainer .drawer {
...@@ -1155,6 +1175,9 @@ body.compact nav ul li.logo { ...@@ -1155,6 +1175,9 @@ body.compact nav ul li.logo {
height: 3.5em; height: 3.5em;
line-height: 3.5em; line-height: 3.5em;
} }
body.compact nav ul:nth-child(2) #versionNumber {
margin-left: 5em;
}
body.compact #autoCompleteContainer, body.compact #autoCompleteContainer,
body.compact #drawerContainer .drawer { body.compact #drawerContainer .drawer {
padding: 1.5em; padding: 1.5em;
......
This diff is collapsed.
...@@ -31,7 +31,12 @@ ...@@ -31,7 +31,12 @@
</ul> </ul>
<ul> <ul>
<li><a href="#" id="navBtnSettings" tabindex="-1"><i class="fas fa-cog"></i></a></li> <li><a href="#" id="navBtnSettings" tabindex="-1"><i class="fas fa-cog"></i></a></li>
<li><a href="#" id="navBtnHelp" tabindex="-1"><i class="fas fa-question-circle"></i></a></li> <li>
<a href="#" id="navBtnHelp" tabindex="-1">
<i class="fas fa-question-circle"></i>
<code id="versionNumber"></code>
</a>
</li>
</ul> </ul>
<div id="drawerContainer"> <div id="drawerContainer">
<section id="filterDrawer" class="drawer dropdown" tabindex="0"> <section id="filterDrawer" class="drawer dropdown" tabindex="0">
......
...@@ -484,14 +484,18 @@ function generateFilterButtons(category, autoCompleteValue, autoCompletePrefix, ...@@ -484,14 +484,18 @@ function generateFilterButtons(category, autoCompleteValue, autoCompletePrefix,
// add filter to input // add filter to input
todoFiltersItem.addEventListener("click", (event) => { todoFiltersItem.addEventListener("click", (event) => {
if(autoCompletePrefix && autoCompleteValue) { if(autoCompletePrefix && autoCompleteValue) {
// remove composed filter first // split string into elements
let newValue = document.getElementById("modalFormInput").value.slice(0, caretPosition - autoCompleteValue.length) + document.getElementById("modalFormInput").value.slice(caretPosition); let inputElements = document.getElementById("modalFormInput").value.split(" ");
// split string into single characters let i;
newValue = newValue.split(""); let x = 0;
//then add selected filter at index for(i = 0; i < inputElements.length; i++) {
newValue.splice(caretPosition - autoCompleteValue.length, 0, todoFiltersItem.getAttribute("data-filter")); x += inputElements[i].length + 1;
// join back from single characters to string // once caret position is found inside element the index is persisted
document.getElementById("modalFormInput").value = newValue.join(""); if(x > caretPosition) break;
}
// replace value at index with prefix and data attribute of filter
inputElements.splice(i, 1, autoCompletePrefix + todoFiltersItem.getAttribute("data-filter"));
document.getElementById("modalFormInput").value = inputElements.join(" ");
} else if(autoCompletePrefix) { } else if(autoCompletePrefix) {
// add button data value to the exact caret position // add button data value to the exact caret position
document.getElementById("modalFormInput").value = [document.getElementById("modalFormInput").value.slice(0, caretPosition), todoFiltersItem.getAttribute('data-filter'), document.getElementById("modalFormInput").value.slice(caretPosition)].join('') + " "; document.getElementById("modalFormInput").value = [document.getElementById("modalFormInput").value.slice(0, caretPosition), todoFiltersItem.getAttribute('data-filter'), document.getElementById("modalFormInput").value.slice(caretPosition)].join('') + " ";
......
...@@ -176,15 +176,16 @@ function modalFormInputEvent(event) { ...@@ -176,15 +176,16 @@ function modalFormInputEvent(event) {
let autoCompletePrefix = ""; let autoCompletePrefix = "";
let caretPosition = getCaretPosition(document.getElementById("modalFormInput")); let caretPosition = getCaretPosition(document.getElementById("modalFormInput"));
let autoCompleteCategory = ""; let autoCompleteCategory = "";
if((document.getElementById("modalFormInput").value.charAt(caretPosition-2) === " " || document.getElementById("modalFormInput").value.charAt(caretPosition-2) === "\n") && (document.getElementById("modalFormInput").value.charAt(caretPosition-1) === "@" || document.getElementById("modalFormInput").value.charAt(caretPosition-1) === "+")) { let inputValue = document.getElementById("modalFormInput").value;
autoCompleteValue = document.getElementById("modalFormInput").value.substr(caretPosition, document.getElementById("modalFormInput").value.lastIndexOf(" ")).split(" ").shift(); if((inputValue.charAt(caretPosition-2) === " " || inputValue.charAt(caretPosition-2) === "\n") && (inputValue.charAt(caretPosition-1) === "@" || inputValue.charAt(caretPosition-1) === "+")) {
autoCompletePrefix = document.getElementById("modalFormInput").value.charAt(caretPosition-1); autoCompleteValue = inputValue.substr(caretPosition, inputValue.lastIndexOf(" ")).split(" ").shift();
} else if(document.getElementById("modalFormInput").value.charAt(caretPosition) === " ") { autoCompletePrefix = inputValue.charAt(caretPosition-1);
autoCompleteValue = document.getElementById("modalFormInput").value.substr(document.getElementById("modalFormInput").value.lastIndexOf(" ", caretPosition-1)+2).split(" ").shift(); } else if(inputValue.charAt(caretPosition) === " ") {
autoCompletePrefix = document.getElementById("modalFormInput").value.charAt(document.getElementById("modalFormInput").value.lastIndexOf(" ", caretPosition-1)+1); autoCompleteValue = inputValue.substr(inputValue.lastIndexOf(" ", caretPosition-1)+2).split(" ").shift();
} else if(document.getElementById("modalFormInput").value.charAt(document.getElementById("modalFormInput").value.lastIndexOf(" ", caretPosition)+1) === "@" || document.getElementById("modalFormInput").value.charAt(document.getElementById("modalFormInput").value.lastIndexOf(" ", caretPosition)+1) === "+") { autoCompletePrefix = inputValue.charAt(inputValue.lastIndexOf(" ", caretPosition-1)+1);
autoCompleteValue = document.getElementById("modalFormInput").value.substr(document.getElementById("modalFormInput").value.lastIndexOf(" ", caretPosition)+2).split(" ").shift(); } else if(inputValue.charAt(inputValue.lastIndexOf(" ", caretPosition)+1) === "@" || inputValue.charAt(inputValue.lastIndexOf(" ", caretPosition)+1) === "+") {
autoCompletePrefix = document.getElementById("modalFormInput").value.charAt(document.getElementById("modalFormInput").value.lastIndexOf(" ", caretPosition)+1); autoCompleteValue = inputValue.substr(inputValue.lastIndexOf(" ", caretPosition)+2).split(" ").shift();
autoCompletePrefix = inputValue.charAt(inputValue.lastIndexOf(" ", caretPosition)+1);
} else { } else {
autoCompleteContainer.classList.remove("is-active"); autoCompleteContainer.classList.remove("is-active");
autoCompleteContainer.blur(); autoCompleteContainer.blur();
......
import { userData, translations } from "../render.js"; import { userData, appData, translations } from "../render.js";
import { showContent } from "./content.mjs"; import { showContent } from "./content.mjs";
import { show } from "./form.mjs"; import { show } from "./form.mjs";
import { _paq } from "./matomo.mjs"; import { _paq } from "./matomo.mjs";
...@@ -7,11 +7,14 @@ const navBtnAddTodo = document.getElementById("navBtnAddTodo"); ...@@ -7,11 +7,14 @@ const navBtnAddTodo = document.getElementById("navBtnAddTodo");
const navBtnHelp = document.getElementById("navBtnHelp"); const navBtnHelp = document.getElementById("navBtnHelp");
const navBtnSettings = document.getElementById("navBtnSettings"); const navBtnSettings = document.getElementById("navBtnSettings");
const navBtnView = document.getElementById("navBtnView"); const navBtnView = document.getElementById("navBtnView");
const versionNumber = document.getElementById("versionNumber");
navBtnHelp.firstElementChild.setAttribute("title", translations.help); navBtnHelp.firstElementChild.setAttribute("title", translations.help);
navBtnSettings.firstElementChild.setAttribute("title", translations.settings); navBtnSettings.firstElementChild.setAttribute("title", translations.settings);
navBtnView.firstElementChild.setAttribute("title", translations.view); navBtnView.firstElementChild.setAttribute("title", translations.view);
versionNumber.innerHTML = appData.version;
navBtnAddTodo.onclick = function () { navBtnAddTodo.onclick = function () {
show(); show();
// trigger matomo event // trigger matomo event
......
...@@ -173,9 +173,18 @@ const createWindow = async function() { ...@@ -173,9 +173,18 @@ const createWindow = async function() {
// skip persisted files and go with ENV if set // skip persisted files and go with ENV if set
if(process.env.SLEEK_CUSTOM_FILE && fs.existsSync(process.env.SLEEK_CUSTOM_FILE)) { if(process.env.SLEEK_CUSTOM_FILE && fs.existsSync(process.env.SLEEK_CUSTOM_FILE)) {
file = process.env.SLEEK_CUSTOM_FILE; file = process.env.SLEEK_CUSTOM_FILE;
} /*else if(process.argv.length > 1 && fs.existsSync(process.argv[1])) { }
file = process.argv[1]; let args;
}*/ if (process.defaultApp) {
// electron "unbundled" app -- have to skip "electron" and script name arg eg: "."
args = process.argv.slice(2);
} else {
// electron "bundled" app -- skip only the app name, eg: "sleek"
args = process.argv.slice(1);
}
if (args.length > 0 && fs.existsSync(args[0])) {
file = args[0];
}
// use the loop to check if the new path is already in the user data // use the loop to check if the new path is already in the user data
let fileFound = false; let fileFound = false;
if(userData.data.files) { if(userData.data.files) {
......
...@@ -79,13 +79,20 @@ ...@@ -79,13 +79,20 @@
} }
} }
} }
nav ul { nav {
width: 3.5em; ul {
li a,
li.logo {
width: 3.5em; width: 3.5em;
height: 3.5em; li a,
line-height: 3.5em; li.logo {
width: 3.5em;
height: 3.5em;
line-height: 3.5em;
}
}
ul:nth-child(2) {
#versionNumber {
margin-left: 5em;
}
} }
} }
#autoCompleteContainer, #autoCompleteContainer,
......
...@@ -14,6 +14,7 @@ nav { ...@@ -14,6 +14,7 @@ nav {
li a, li a,
li.logo { li.logo {
width: 5em; width: 5em;
position: relative;
display: block; display: block;
height: 5em; height: 5em;
line-height: 5em; line-height: 5em;
...@@ -40,5 +41,23 @@ nav { ...@@ -40,5 +41,23 @@ nav {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
#versionNumber {
width: auto!important;
padding: 0.1em;
line-height: 1em;
display: none;
position: fixed;
bottom: 0.2em;
z-index: 80;
margin-left: 7em;
font-size: 0.8em;
color: $mid-grey;
background: white!important;
}
}
ul:nth-child(2):hover {
#versionNumber {
display: flex;
}
} }
} }
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
top: 0.8em; top: 0.8em;
left: 1.4em; left: 1.4em;
z-index: 70; z-index: 70;
padding: 0.75em 0.75em 0.75em 0; padding: 0.75em 0;
} }
} }
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