Merge pull request #3857 from mfilser/view_and_change_card_sort_number

View and change card sort number
reviewable/pr3858/r1
Lauri Ojansivu 4 years ago committed by GitHub
commit ac3d658cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      client/components/cards/cardDetails.jade
  2. 22
      client/components/cards/cardDetails.js
  3. 4
      client/components/cards/minicard.jade
  4. 6
      client/components/sidebar/sidebar.jade
  5. 20
      client/components/sidebar/sidebar.js
  6. 1
      i18n/en.i18n.json
  7. 12
      models/boards.js

@ -203,6 +203,19 @@ template(name="cardDetails")
+viewer +viewer
= getAssignedBy = 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 //.card-details-items
if customFieldsWD if customFieldsWD
hr hr
@ -540,6 +553,12 @@ template(name="editCardAssignerForm")
button.primary.confirm.js-submit-edit-card-assigner-form(type="submit") {{_ 'save'}} button.primary.confirm.js-submit-edit-card-assigner-form(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form 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") template(name="cardDetailsActionsPopup")
ul.pop-over-list ul.pop-over-list
li li

@ -361,6 +361,16 @@ BlazeComponent.extendComponent({
this.data().setRequestedBy(''); 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'() { 'click .js-go-to-linked-card'() {
Utils.goCardId(this.data().linkedId); Utils.goCardId(this.data().linkedId);
}, },
@ -489,6 +499,18 @@ BlazeComponent.extendComponent({
}, },
}).register('cardDetails'); }).register('cardDetails');
// only allow number input
Template.editCardSortOrderForm.onRendered(function() {
this.$('input').on("keypress paste", function() {
let keyCode = event.keyCode;
let charCode = String.fromCharCode(keyCode);
let regex = new RegExp('[-0-9.]');
let ret = regex.test(charCode);
// only working here, defining in events() doesn't handle the return value correctly
return ret;
});
});
// We extends the normal InlinedForm component to support UnsavedEdits draft // We extends the normal InlinedForm component to support UnsavedEdits draft
// feature. // feature.
(class extends InlinedForm { (class extends InlinedForm {

@ -139,3 +139,7 @@ template(name="minicard")
span.badge-icon.fa.fa-sitemap span.badge-icon.fa.fa-sitemap
span.badge-text.check-list-text {{subtasksFinishedCount}}/{{allSubtasksCount}} span.badge-text.check-list-text {{subtasksFinishedCount}}/{{allSubtasksCount}}
//{{subtasksFinishedCount}}/{{subtasksCount}} does not work because when a subtaks is archived, the count goes down //{{subtasksFinishedCount}}/{{subtasksCount}} does not work because when a subtaks is archived, the count goes down
if currentBoard.allowsCardSortingByNumber
.badge
span.badge-icon.fa.fa-sort
span.badge-text {{ sort }}

@ -133,6 +133,12 @@ template(name="boardCardSettingsPopup")
span span
i.fa.fa-user-plus i.fa.fa-user-plus
| {{_ 'requested-by'}} | {{_ '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 div.check-div
a.flex.js-field-has-labels(class="{{#if allowsLabels}}is-checked{{/if}}") a.flex.js-field-has-labels(class="{{#if allowsLabels}}is-checked{{/if}}")
.materialCheckBox(class="{{#if allowsLabels}}is-checked{{/if}}") .materialCheckBox(class="{{#if allowsLabels}}is-checked{{/if}}")

@ -754,6 +754,10 @@ BlazeComponent.extendComponent({
return this.currentBoard.allowsRequestedBy; return this.currentBoard.allowsRequestedBy;
}, },
allowsCardSortingByNumber() {
return this.currentBoard.allowsCardSortingByNumber;
},
allowsLabels() { allowsLabels() {
return this.currentBoard.allowsLabels; return this.currentBoard.allowsLabels;
}, },
@ -968,6 +972,22 @@ BlazeComponent.extendComponent({
this.currentBoard.allowsRequestedBy, 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) { 'click .js-field-has-labels'(evt) {
evt.preventDefault(); evt.preventDefault();
this.currentBoard.allowsLabels = !this.currentBoard.allowsLabels; this.currentBoard.allowsLabels = !this.currentBoard.allowsLabels;

@ -664,6 +664,7 @@
"setListColorPopup-title": "Choose a color", "setListColorPopup-title": "Choose a color",
"assigned-by": "Assigned By", "assigned-by": "Assigned By",
"requested-by": "Requested By", "requested-by": "Requested By",
"card-sorting-by-number": "Card sorting by number",
"board-delete-notice": "Deleting is permanent. You will lose all lists, cards and actions associated with this board.", "board-delete-notice": "Deleting is permanent. You will lose all lists, cards and actions associated with this board.",
"delete-board-confirm-popup": "All lists, cards, labels, and activities will be deleted and you won't be able to recover the board contents. There is no undo.", "delete-board-confirm-popup": "All lists, cards, labels, and activities will be deleted and you won't be able to recover the board contents. There is no undo.",
"boardDeletePopup-title": "Delete Board?", "boardDeletePopup-title": "Delete Board?",

@ -373,6 +373,14 @@ Boards.attachSchema(
defaultValue: true, defaultValue: true,
}, },
allowsCardSortingByNumber: {
/**
* Does the board allows card sorting by number?
*/
type: Boolean,
defaultValue: true,
},
allowsAssignedBy: { allowsAssignedBy: {
/** /**
* Does the board allows requested by? * Does the board allows requested by?
@ -1190,6 +1198,10 @@ Boards.mutations({
return { $set: { allowsRequestedBy } }; return { $set: { allowsRequestedBy } };
}, },
setAllowsCardSortingByNumber(allowsCardSortingByNumber) {
return { $set: { allowsCardSortingByNumber } };
},
setAllowsAttachments(allowsAttachments) { setAllowsAttachments(allowsAttachments) {
return { $set: { allowsAttachments } }; return { $set: { allowsAttachments } };
}, },

Loading…
Cancel
Save