mirror of
https://github.com/wekan/wekan.git
synced 2026-02-28 02:44:07 +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'}}
|
label {{_ 'set-list-width-value'}}
|
||||||
p
|
p
|
||||||
input.list-width-value(type="number" value="{{ listWidthValue }}" min="100")
|
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-apply(type="submit" value="{{_ 'apply'}}")
|
||||||
input.list-width-error
|
input.list-width-error
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -347,14 +347,20 @@ BlazeComponent.extendComponent({
|
||||||
.val(),
|
.val(),
|
||||||
10,
|
10,
|
||||||
);
|
);
|
||||||
|
const constraint = parseInt(
|
||||||
|
Template.instance()
|
||||||
|
.$('.list-constraint-value')
|
||||||
|
.val(),
|
||||||
|
10,
|
||||||
|
);
|
||||||
|
|
||||||
// FIXME(mark-i-m): where do we put constants?
|
// FIXME(mark-i-m): where do we put constants?
|
||||||
if (width < 100 || !width) {
|
if (width < 100 || !width || constraint < 100 || !constraint) {
|
||||||
Template.instance()
|
Template.instance()
|
||||||
.$('.list-width-error')
|
.$('.list-width-error')
|
||||||
.click();
|
.click();
|
||||||
} else {
|
} else {
|
||||||
Meteor.call('applyListWidth', board, list._id, width);
|
Meteor.call('applyListWidth', board, list._id, width, constraint);
|
||||||
Popup.back();
|
Popup.back();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -365,6 +371,12 @@ BlazeComponent.extendComponent({
|
||||||
return ReactiveCache.getCurrentUser().getListWidth(board, list._id);
|
return ReactiveCache.getCurrentUser().getListWidth(board, list._id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
listConstraintValue() {
|
||||||
|
const list = Template.currentData();
|
||||||
|
const board = list.boardId;
|
||||||
|
return ReactiveCache.getCurrentUser().getListConstraint(board, list._id);
|
||||||
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -417,6 +417,15 @@ Users.attachSchema(
|
||||||
defaultValue: {},
|
defaultValue: {},
|
||||||
blackbox: true,
|
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': {
|
'profile.autoWidthBoards': {
|
||||||
/**
|
/**
|
||||||
* User-specified flag for enabling auto-width for boards (false is the default).
|
* 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) {
|
setSwimlaneHeight(boardId, swimlaneId, height) {
|
||||||
let currentHeights = this.getSwimlaneHeights();
|
let currentHeights = this.getSwimlaneHeights();
|
||||||
if (!currentHeights[boardId]) {
|
if (!currentHeights[boardId]) {
|
||||||
|
|
@ -1224,12 +1246,14 @@ Meteor.methods({
|
||||||
check(startDay, Number);
|
check(startDay, Number);
|
||||||
ReactiveCache.getCurrentUser().setStartDayOfWeek(startDay);
|
ReactiveCache.getCurrentUser().setStartDayOfWeek(startDay);
|
||||||
},
|
},
|
||||||
applyListWidth(boardId, listId, width) {
|
applyListWidth(boardId, listId, width, constraint) {
|
||||||
check(boardId, String);
|
check(boardId, String);
|
||||||
check(listId, String);
|
check(listId, String);
|
||||||
check(width, Number);
|
check(width, Number);
|
||||||
|
check(constraint, Number);
|
||||||
const user = ReactiveCache.getCurrentUser();
|
const user = ReactiveCache.getCurrentUser();
|
||||||
user.setListWidth(boardId, listId, width);
|
user.setListWidth(boardId, listId, width);
|
||||||
|
user.setListConstraint(boardId, listId, constraint);
|
||||||
},
|
},
|
||||||
applySwimlaneHeight(boardId, swimlaneId, height) {
|
applySwimlaneHeight(boardId, swimlaneId, height) {
|
||||||
check(boardId, String);
|
check(boardId, String);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue