Merge pull request #3545 from mfilser/settings-show_cards_count_broken_at_mobile_view

Settings, "Show cards count" now works at mobile view too
This commit is contained in:
Lauri Ojansivu 2021-02-08 19:45:40 +02:00 committed by GitHub
commit 81aa17f3f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View file

@ -82,7 +82,7 @@ BlazeComponent.extendComponent({
showCardsCountForList(count) {
const limit = this.limitToShowCardsCount();
return limit > 0 && count > limit;
return limit >= 0 && count > limit;
},
events() {

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="-1")
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 < -1) {
minLimit = -1;
}
if (!isNaN(minLimit)) {
if (currentUser) {
Meteor.call('changeLimitToShowCardsCount', minLimit);