make swimlane height adjustable

This commit is contained in:
mark 2023-06-13 13:43:09 -05:00
parent 0ec9c4c37b
commit 26d2efdedb
8 changed files with 108 additions and 3 deletions

View file

@ -165,7 +165,7 @@ template(name="setListWidthPopup")
#js-list-width-edit
label {{_ 'set-list-width-value'}}
p
input.list-width-value(type="number" value="{{ listWidthValue }}" min="100" max="800")
input.list-width-value(type="number" value="{{ listWidthValue }}" min="100")
input.list-width-apply(type="submit" value="{{_ 'apply'}}")
input.list-width-error

View file

@ -44,6 +44,9 @@ template(name="swimlaneActionPopup")
li: a.js-set-swimlane-color
i.fa.fa-paint-brush
| {{_ 'select-color'}}
li: a.js-set-swimlane-height
i.fa.fa-arrows-v
| {{_ 'set-swimlane-height'}}
unless this.isTemplateContainer
hr
ul.pop-over-list
@ -82,6 +85,19 @@ template(name="setSwimlaneColorPopup")
button.primary.confirm.js-submit {{_ 'save'}}
button.js-remove-color.negate.wide.right {{_ 'unset-color'}}
template(name="setSwimlaneHeightPopup")
#js-swimlane-height-edit
label {{_ 'set-swimlane-height-value'}}
p
input.swimlane-height-value(type="number" value="{{ swimlaneHeightValue }}" min="100")
input.swimlane-height-apply(type="submit" value="{{_ 'apply'}}")
input.swimlane-height-error
template(name="swimlaneHeightErrorPopup")
.swimlane-height-invalid
p {{_ 'swimlane-height-error-message'}}
button.full.js-back-view(type="submit") {{_ 'cancel'}}
template(name="swimlaneDeletePopup")
p {{_ "swimlane-delete-pop"}}
button.js-confirm.negate.full(type="submit") {{_ 'delete'}}

View file

@ -36,6 +36,7 @@ Template.swimlaneFixedHeader.helpers({
Template.swimlaneActionPopup.events({
'click .js-set-swimlane-color': Popup.open('setSwimlaneColor'),
'click .js-set-swimlane-height': Popup.open('setSwimlaneHeight'),
'click .js-close-swimlane'(event) {
event.preventDefault();
this.archive();
@ -128,3 +129,45 @@ BlazeComponent.extendComponent({
];
},
}).register('setSwimlaneColorPopup');
BlazeComponent.extendComponent({
onCreated() {
this.currentSwimlane = this.currentData();
},
applySwimlaneHeight() {
const swimlane = this.currentData();
const board = swimlane.boardId;
const height = parseInt(
Template.instance()
.$('.swimlane-height-value')
.val(),
10,
);
// FIXME(mark-i-m): where do we put constants?
if (height < 100 || !height) {
Template.instance()
.$('.swimlane-height-error')
.click();
} else {
Meteor.call('applySwimlaneHeight', board, swimlane._id, height);
Popup.back();
}
},
swimlaneHeightValue() {
const swimlane = this.currentData();
const board = swimlane.boardId;
return Meteor.user().getSwimlaneHeight(board, swimlane._id);
},
events() {
return [
{
'click .swimlane-height-apply': this.applySwimlaneHeight,
'click .swimlane-height-error': Popup.open('swimlaneHeightError'),
},
];
},
}).register('setSwimlaneHeightPopup');

View file

@ -116,6 +116,9 @@
left: 87vw;
font-size: 24px;
}
#js-swimlane-height-edit .swimlane-height-error {
display: none;
}
.list-group {
height: 100%;
}

View file

@ -2,7 +2,8 @@ template(name="swimlane")
.swimlane
+swimlaneHeader
unless collapseSwimlane
.swimlane.js-lists.js-swimlane(id="swimlane-{{_id}}")
.swimlane.js-lists.js-swimlane(id="swimlane-{{_id}}"
style="height:{{swimlaneHeight}}px;")
if isMiniScreen
if currentListIsInThisSwimlane _id
+list(currentList)

View file

@ -235,6 +235,12 @@ BlazeComponent.extendComponent({
},
];
},
swimlaneHeight() {
const user = Meteor.user();
const swimlane = Template.currentData();
return user.getSwimlaneHeight(swimlane.boardId, swimlane._id);
},
}).register('swimlane');
BlazeComponent.extendComponent({