Settings, "Show cards count" keyboard input possible

This commit is contained in:
Martin Filser 2021-02-06 15:25:10 +01:00
parent 2972351e79
commit b79fc53265
2 changed files with 12 additions and 2 deletions

View file

@ -143,7 +143,7 @@ template(name="changeSettingsPopup")
label.bold.clear
i.fa.fa-sort-numeric-asc
| {{_ 'show-cards-minimum-count'}}
input#show-cards-count-at.inline-input.left(type="number" value="#{showCardsCountAt}" min="0" max="99" onkeydown="return false")
input#show-cards-count-at.inline-input.left(type="number" value="#{showCardsCountAt}" min="0" max="99")
label.bold.clear
i.fa.fa-calendar
| {{_ 'start-day-of-week'}}

View file

@ -271,6 +271,13 @@ Template.changeSettingsPopup.helpers({
});
Template.changeSettingsPopup.events({
'keypress/paste #show-cards-count-at'() {
let keyCode = event.keyCode;
let charCode = String.fromCharCode(keyCode);
let regex = new RegExp("[0-9]");
let ret = regex.test(charCode);
return ret;
},
'click .js-toggle-desktop-drag-handles'() {
currentUser = Meteor.user();
if (currentUser) {
@ -293,7 +300,7 @@ Template.changeSettingsPopup.events({
},
'click .js-apply-user-settings'(event, templateInstance) {
event.preventDefault();
const minLimit = parseInt(
let minLimit = parseInt(
templateInstance.$('#show-cards-count-at').val(),
10,
);
@ -302,6 +309,9 @@ Template.changeSettingsPopup.events({
10,
);
const currentUser = Meteor.user();
if (isNaN(minLimit)) {
minLimit = 0;
}
if (!isNaN(minLimit)) {
if (currentUser) {
Meteor.call('changeLimitToShowCardsCount', minLimit);