mirror of
https://github.com/wekan/wekan.git
synced 2025-12-24 11:20:13 +01:00
Add list constraint support in set-width popup
This commit is contained in:
parent
fb34dd6114
commit
efe50a65ee
3 changed files with 40 additions and 3 deletions
|
|
@ -191,6 +191,7 @@ template(name="setListWidthPopup")
|
|||
label {{_ 'set-list-width-value'}}
|
||||
p
|
||||
input.list-width-value(type="number" value="{{ listWidthValue }}" min="100")
|
||||
input.list-constraint-value(type="number" value="{{ listConstraintValue }}" min="100")
|
||||
input.list-width-apply(type="submit" value="{{_ 'apply'}}")
|
||||
input.list-width-error
|
||||
|
||||
|
|
|
|||
|
|
@ -347,14 +347,20 @@ BlazeComponent.extendComponent({
|
|||
.val(),
|
||||
10,
|
||||
);
|
||||
const constraint = parseInt(
|
||||
Template.instance()
|
||||
.$('.list-constraint-value')
|
||||
.val(),
|
||||
10,
|
||||
);
|
||||
|
||||
// FIXME(mark-i-m): where do we put constants?
|
||||
if (width < 100 || !width) {
|
||||
if (width < 100 || !width || constraint < 100 || !constraint) {
|
||||
Template.instance()
|
||||
.$('.list-width-error')
|
||||
.click();
|
||||
} else {
|
||||
Meteor.call('applyListWidth', board, list._id, width);
|
||||
Meteor.call('applyListWidth', board, list._id, width, constraint);
|
||||
Popup.back();
|
||||
}
|
||||
},
|
||||
|
|
@ -365,6 +371,12 @@ BlazeComponent.extendComponent({
|
|||
return ReactiveCache.getCurrentUser().getListWidth(board, list._id);
|
||||
},
|
||||
|
||||
listConstraintValue() {
|
||||
const list = Template.currentData();
|
||||
const board = list.boardId;
|
||||
return ReactiveCache.getCurrentUser().getListConstraint(board, list._id);
|
||||
},
|
||||
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -417,6 +417,15 @@ Users.attachSchema(
|
|||
defaultValue: {},
|
||||
blackbox: true,
|
||||
},
|
||||
'profile.listConstraints': {
|
||||
/**
|
||||
* User-specified constraint of each list (or nothing if default).
|
||||
* profile[boardId][listId] = constraint;
|
||||
*/
|
||||
type: Object,
|
||||
defaultValue: {},
|
||||
blackbox: true,
|
||||
},
|
||||
'profile.autoWidthBoards': {
|
||||
/**
|
||||
* User-specified flag for enabling auto-width for boards (false is the default).
|
||||
|
|
@ -1173,6 +1182,19 @@ Users.mutations({
|
|||
};
|
||||
},
|
||||
|
||||
setListConstraint(boardId, listId, constraint) {
|
||||
let currentConstraints = this.getListConstraints();
|
||||
if (!currentConstraints[boardId]) {
|
||||
currentConstraints[boardId] = {};
|
||||
}
|
||||
currentConstraints[boardId][listId] = constraint;
|
||||
return {
|
||||
$set: {
|
||||
'profile.listConstraints': currentConstraints,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setSwimlaneHeight(boardId, swimlaneId, height) {
|
||||
let currentHeights = this.getSwimlaneHeights();
|
||||
if (!currentHeights[boardId]) {
|
||||
|
|
@ -1224,12 +1246,14 @@ Meteor.methods({
|
|||
check(startDay, Number);
|
||||
ReactiveCache.getCurrentUser().setStartDayOfWeek(startDay);
|
||||
},
|
||||
applyListWidth(boardId, listId, width) {
|
||||
applyListWidth(boardId, listId, width, constraint) {
|
||||
check(boardId, String);
|
||||
check(listId, String);
|
||||
check(width, Number);
|
||||
check(constraint, Number);
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
user.setListWidth(boardId, listId, width);
|
||||
user.setListConstraint(boardId, listId, constraint);
|
||||
},
|
||||
applySwimlaneHeight(boardId, swimlaneId, height) {
|
||||
check(boardId, String);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue