mirror of
https://github.com/wekan/wekan.git
synced 2025-12-24 03:10:12 +01:00
Fix Swimlane Default title from "key default returned an object instead of string" to translated title of "Default".
Thanks to titho85, hpvb and xet7 ! Fixes #4763, fixes #4742
This commit is contained in:
parent
9a9dbd26f9
commit
73a25775e1
4 changed files with 80 additions and 5 deletions
|
|
@ -79,18 +79,18 @@ template(name="linkCardPopup")
|
||||||
select.js-select-boards
|
select.js-select-boards
|
||||||
option(value="")
|
option(value="")
|
||||||
each boards
|
each boards
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{isTitleDefault title}}
|
||||||
input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
|
input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
|
||||||
|
|
||||||
label {{_ 'swimlanes'}}:
|
label {{_ 'swimlanes'}}:
|
||||||
select.js-select-swimlanes
|
select.js-select-swimlanes
|
||||||
each swimlanes
|
each swimlanes
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{isTitleDefault title}}
|
||||||
|
|
||||||
label {{_ 'lists'}}:
|
label {{_ 'lists'}}:
|
||||||
select.js-select-lists
|
select.js-select-lists
|
||||||
each lists
|
each lists
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{isTitleDefault title}}
|
||||||
|
|
||||||
label {{_ 'cards'}}:
|
label {{_ 'cards'}}:
|
||||||
select.js-select-cards
|
select.js-select-cards
|
||||||
|
|
|
||||||
|
|
@ -593,6 +593,31 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
}).register('linkCardPopup');
|
}).register('linkCardPopup');
|
||||||
|
|
||||||
|
Template.linkCardPopup.helpers({
|
||||||
|
isTitleDefault(title) {
|
||||||
|
// https://github.com/wekan/wekan/issues/4763
|
||||||
|
// https://github.com/wekan/wekan/issues/4742
|
||||||
|
// Translation text for "default" does not work, it returns an object.
|
||||||
|
// When that happens, try use translation "defaultdefault" that has same content of default, or return text "Default".
|
||||||
|
// This can happen, if swimlane does not have name.
|
||||||
|
// Yes, this is fixing the symptom (Swimlane title does not have title)
|
||||||
|
// instead of fixing the problem (Add Swimlane title when creating swimlane)
|
||||||
|
// because there could be thousands of swimlanes, adding name Default to all of them
|
||||||
|
// would be very slow.
|
||||||
|
if (title.startsWith("key 'default") && title.endsWith('returned an object instead of string.')) {
|
||||||
|
if (`${TAPi18n.__('defaultdefault')}`.startsWith("key 'default") && `${TAPi18n.__('defaultdefault')}`.endsWith('returned an object instead of string.')) {
|
||||||
|
return 'Default';
|
||||||
|
} else {
|
||||||
|
return `${TAPi18n.__('defaultdefault')}`;
|
||||||
|
}
|
||||||
|
} else if (title === 'Default') {
|
||||||
|
return `${TAPi18n.__('defaultdefault')}`;
|
||||||
|
} else {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
mixins() {
|
mixins() {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,11 @@ template(name="swimlaneFixedHeader")
|
||||||
| {{_ 'list-templates-swimlane'}}
|
| {{_ 'list-templates-swimlane'}}
|
||||||
else if $eq title 'Board Templates'
|
else if $eq title 'Board Templates'
|
||||||
| {{_ 'board-templates-swimlane'}}
|
| {{_ 'board-templates-swimlane'}}
|
||||||
|
else if $eq title 'Default'
|
||||||
|
| {{_ 'defaultdefault'}}
|
||||||
else
|
else
|
||||||
+viewer
|
+viewer
|
||||||
= title
|
| {{isTitleDefault title}}
|
||||||
.swimlane-header-menu
|
.swimlane-header-menu
|
||||||
unless currentUser.isCommentOnly
|
unless currentUser.isCommentOnly
|
||||||
if currentUser.isBoardAdmin
|
if currentUser.isBoardAdmin
|
||||||
|
|
@ -33,7 +35,7 @@ template(name="swimlaneFixedHeader")
|
||||||
|
|
||||||
template(name="editSwimlaneTitleForm")
|
template(name="editSwimlaneTitleForm")
|
||||||
.list-composer
|
.list-composer
|
||||||
input.list-name-input.full-line(type="text" value=title autofocus)
|
input.list-name-input.full-line(type="text" value="{{isTitleDefault title}}" autofocus)
|
||||||
.edit-controls.clearfix
|
.edit-controls.clearfix
|
||||||
button.primary.confirm(type="submit") {{_ 'save'}}
|
button.primary.confirm(type="submit") {{_ 'save'}}
|
||||||
a.fa.fa-times-thin.js-close-inlined-form
|
a.fa.fa-times-thin.js-close-inlined-form
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { TAPi18n } from '/imports/i18n';
|
||||||
import { ReactiveCache } from '/imports/reactiveCache';
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
const { calculateIndexData } = Utils;
|
const { calculateIndexData } = Utils;
|
||||||
|
|
||||||
|
|
@ -33,6 +34,53 @@ Template.swimlaneFixedHeader.helpers({
|
||||||
isBoardAdmin() {
|
isBoardAdmin() {
|
||||||
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
||||||
},
|
},
|
||||||
|
isTitleDefault(title) {
|
||||||
|
// https://github.com/wekan/wekan/issues/4763
|
||||||
|
// https://github.com/wekan/wekan/issues/4742
|
||||||
|
// Translation text for "default" does not work, it returns an object.
|
||||||
|
// When that happens, try use translation "defaultdefault" that has same content of default, or return text "Default".
|
||||||
|
// This can happen, if swimlane does not have name.
|
||||||
|
// Yes, this is fixing the symptom (Swimlane title does not have title)
|
||||||
|
// instead of fixing the problem (Add Swimlane title when creating swimlane)
|
||||||
|
// because there could be thousands of swimlanes, adding name Default to all of them
|
||||||
|
// would be very slow.
|
||||||
|
if (title.startsWith("key 'default") && title.endsWith('returned an object instead of string.')) {
|
||||||
|
if (`${TAPi18n.__('defaultdefault')}`.startsWith("key 'default") && `${TAPi18n.__('defaultdefault')}`.endsWith('returned an object instead of string.')) {
|
||||||
|
return 'Default';
|
||||||
|
} else {
|
||||||
|
return `${TAPi18n.__('defaultdefault')}`;
|
||||||
|
}
|
||||||
|
} else if (title === 'Default') {
|
||||||
|
return `${TAPi18n.__('defaultdefault')}`;
|
||||||
|
} else {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.editSwimlaneTitleForm.helpers({
|
||||||
|
isTitleDefault(title) {
|
||||||
|
// https://github.com/wekan/wekan/issues/4763
|
||||||
|
// https://github.com/wekan/wekan/issues/4742
|
||||||
|
// Translation text for "default" does not work, it returns an object.
|
||||||
|
// When that happens, try use translation "defaultdefault" that has same content of default, or return text "Default".
|
||||||
|
// This can happen, if swimlane does not have name.
|
||||||
|
// Yes, this is fixing the symptom (Swimlane title does not have title)
|
||||||
|
// instead of fixing the problem (Add Swimlane title when creating swimlane)
|
||||||
|
// because there could be thousands of swimlanes, adding name Default to all of them
|
||||||
|
// would be very slow.
|
||||||
|
if (title.startsWith("key 'default") && title.endsWith('returned an object instead of string.')) {
|
||||||
|
if (`${TAPi18n.__('defaultdefault')}`.startsWith("key 'default") && `${TAPi18n.__('defaultdefault')}`.endsWith('returned an object instead of string.')) {
|
||||||
|
return 'Default';
|
||||||
|
} else {
|
||||||
|
return `${TAPi18n.__('defaultdefault')}`;
|
||||||
|
}
|
||||||
|
} else if (title === 'Default') {
|
||||||
|
return `${TAPi18n.__('defaultdefault')}`;
|
||||||
|
} else {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.swimlaneActionPopup.events({
|
Template.swimlaneActionPopup.events({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue