CardDetails sorting number is displayed at card and can be modified (if configured)

This commit is contained in:
Martin Filser 2021-04-12 23:34:02 +02:00
parent ab22fb27ce
commit 540ce3a6ed
6 changed files with 68 additions and 0 deletions

View file

@ -203,6 +203,19 @@ template(name="cardDetails")
+viewer
= getAssignedBy
if currentBoard.allowsCardSortingByNumber
.card-details-item.card-details-sort-order
h3.card-details-item-title
i.fa.fa-sort
| {{_ 'sort'}}
if canModifyCard
+inlinedForm(classNames="js-card-details-sort")
+editCardSortOrderForm
else
a.js-open-inlined-form
+viewer
= sort
//.card-details-items
if customFieldsWD
hr
@ -540,6 +553,12 @@ template(name="editCardAssignerForm")
button.primary.confirm.js-submit-edit-card-assigner-form(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
template(name="editCardSortOrderForm")
input.js-edit-card-sort(type='text' autofocus value=sort dir="auto")
.edit-controls.clearfix
button.primary.confirm.js-submit-edit-card-sort-form(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
template(name="cardDetailsActionsPopup")
ul.pop-over-list
li

View file

@ -361,6 +361,16 @@ BlazeComponent.extendComponent({
this.data().setRequestedBy('');
}
},
'submit .js-card-details-sort'(event) {
event.preventDefault();
const sort = parseFloat(this.currentComponent()
.getValue()
.trim());
if (sort) {
let card = this.data();
card.move(card.boardId, card.swimlaneId, card.listId, sort);
}
},
'click .js-go-to-linked-card'() {
Utils.goCardId(this.data().linkedId);
},

View file

@ -133,6 +133,12 @@ template(name="boardCardSettingsPopup")
span
i.fa.fa-user-plus
| {{_ 'requested-by'}}
div.check-div
a.flex.js-field-has-card-sorting-by-number(class="{{#if allowsCardSortingByNumber}}is-checked{{/if}}")
.materialCheckBox(class="{{#if allowsCardSortingByNumber}}is-checked{{/if}}")
span
i.fa.fa-sort
| {{_ 'card-sorting-by-number'}}
div.check-div
a.flex.js-field-has-labels(class="{{#if allowsLabels}}is-checked{{/if}}")
.materialCheckBox(class="{{#if allowsLabels}}is-checked{{/if}}")

View file

@ -754,6 +754,10 @@ BlazeComponent.extendComponent({
return this.currentBoard.allowsRequestedBy;
},
allowsCardSortingByNumber() {
return this.currentBoard.allowsCardSortingByNumber;
},
allowsLabels() {
return this.currentBoard.allowsLabels;
},
@ -968,6 +972,22 @@ BlazeComponent.extendComponent({
this.currentBoard.allowsRequestedBy,
);
},
'click .js-field-has-card-sorting-by-number'(evt) {
evt.preventDefault();
this.currentBoard.allowsCardSortingByNumber = !this.currentBoard
.allowsCardSortingByNumber;
this.currentBoard.setAllowsCardSortingByNumber(
this.currentBoard.allowsCardSortingByNumber,
);
$(`.js-field-has-card-sorting-by-number ${MCB}`).toggleClass(
CKCLS,
this.currentBoard.allowsCardSortingByNumber,
);
$('.js-field-has-card-sorting-by-number').toggleClass(
CKCLS,
this.currentBoard.allowsCardSortingByNumber,
);
},
'click .js-field-has-labels'(evt) {
evt.preventDefault();
this.currentBoard.allowsLabels = !this.currentBoard.allowsLabels;