New feature: Sidebar / Card Settings / Creator at minicard.

Thanks to Roemer and xet7 !

Related https://github.com/wekan/wekan/discussions/5217
This commit is contained in:
Lauri Ojansivu 2023-12-01 13:31:16 +02:00
parent 7f7d06be65
commit f324286911
4 changed files with 38 additions and 5 deletions

View file

@ -129,7 +129,7 @@ template(name="minicard")
each getMembers
+userAvatar(userId=this)
if showCreator
if showCreatorOnMinicard
.minicard-creator
+userAvatar(userId=this.userId noRemove=true)

View file

@ -37,15 +37,15 @@ BlazeComponent.extendComponent({
return ret;
},
showCreator() {
showCreatorOnMinicard() {
// cache "board" to reduce the mini-mongodb access
const board = this.data().board();
let ret = false;
if (board) {
ret =
board.allowsCreator === null ||
board.allowsCreator === undefined ||
board.allowsCreator
board.allowsCreatorOnMinicard === null ||
board.allowsCreatorOnMinicard === undefined ||
board.allowsCreatorOnMinicard
;
}
return ret;

View file

@ -920,6 +920,14 @@ BlazeComponent.extendComponent({
);
},
allowsCreatorOnMinicard() {
return (
this.currentBoard.allowsCreatorOnMinicard === null ||
this.currentBoard.allowsCreatorOnMinicard === undefined ||
this.currentBoard.allowsCreatorOnMinicard
);
},
allowsMembers() {
return this.currentBoard.allowsMembers;
},
@ -1121,6 +1129,19 @@ BlazeComponent.extendComponent({
this.currentBoard.allowsCreator,
);
},
'click .js-field-has-creator-on-minicard'(evt) {
evt.preventDefault();
this.currentBoard.allowsCreatorOnMinicard = !this.currentBoard.allowsCreatorOnMinicard;
this.currentBoard.setAllowsCreatorOnMinicard(this.currentBoard.allowsCreatorOnMinicard);
$(`.js-field-has-creator-on-minicard ${MCB}`).toggleClass(
CKCLS,
this.currentBoard.allowsCreatorOnMinicard,
);
$('.js-field-has-creator-on-minicard').toggleClass(
CKCLS,
this.currentBoard.allowsCreatorOnMinicard,
);
},
'click .js-field-has-members'(evt) {
evt.preventDefault();
this.currentBoard.allowsMembers = !this.currentBoard.allowsMembers;