mirror of
https://github.com/wekan/wekan.git
synced 2025-12-26 20:28:48 +01:00
Add Features: allowing lists to be sorted by modifiedAt when not in draggable mode
This commit is contained in:
parent
e60926f847
commit
77f8b76d4e
7 changed files with 63 additions and 39 deletions
|
|
@ -58,6 +58,8 @@ template(name="minicard")
|
||||||
if getDue
|
if getDue
|
||||||
.date
|
.date
|
||||||
+minicardDueDate
|
+minicardDueDate
|
||||||
|
if getEnd
|
||||||
|
+minicardEndDate
|
||||||
if getSpentTime
|
if getSpentTime
|
||||||
.date
|
.date
|
||||||
+cardSpentTime
|
+cardSpentTime
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ template(name="listHeader")
|
||||||
if currentList
|
if currentList
|
||||||
a.list-header-left-icon.fa.fa-angle-left.js-unselect-list
|
a.list-header-left-icon.fa.fa-angle-left.js-unselect-list
|
||||||
h2.list-header-name(
|
h2.list-header-name(
|
||||||
|
title="{{ moment updatedAt 'LLL' }}"
|
||||||
class="{{#if currentUser.isBoardMember}}{{#unless currentUser.isCommentOnly}}js-open-inlined-form is-editable{{/unless}}{{/if}}")
|
class="{{#if currentUser.isBoardMember}}{{#unless currentUser.isCommentOnly}}js-open-inlined-form is-editable{{/unless}}{{/if}}")
|
||||||
+viewer
|
+viewer
|
||||||
= title
|
= title
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,13 @@ template(name="swimlane")
|
||||||
unless currentUser.isCommentOnly
|
unless currentUser.isCommentOnly
|
||||||
+addListForm
|
+addListForm
|
||||||
else
|
else
|
||||||
|
if currentUser.isBoardMember
|
||||||
|
unless currentUser.isCommentOnly
|
||||||
|
+addListForm
|
||||||
each lists
|
each lists
|
||||||
+list(this)
|
+list(this)
|
||||||
if currentCardIsInThisList _id ../_id
|
if currentCardIsInThisList _id ../_id
|
||||||
+cardDetails(currentCard)
|
+cardDetails(currentCard)
|
||||||
if currentUser.isBoardMember
|
|
||||||
unless currentUser.isCommentOnly
|
|
||||||
+addListForm
|
|
||||||
|
|
||||||
template(name="listsGroup")
|
template(name="listsGroup")
|
||||||
.swimlane.list-group.js-lists
|
.swimlane.list-group.js-lists
|
||||||
|
|
@ -26,20 +26,20 @@ template(name="listsGroup")
|
||||||
if currentList
|
if currentList
|
||||||
+list(currentList)
|
+list(currentList)
|
||||||
else
|
else
|
||||||
each lists
|
|
||||||
+miniList(this)
|
|
||||||
if currentUser.isBoardMember
|
if currentUser.isBoardMember
|
||||||
unless currentUser.isCommentOnly
|
unless currentUser.isCommentOnly
|
||||||
+addListForm
|
+addListForm
|
||||||
|
each lists
|
||||||
|
+miniList(this)
|
||||||
else
|
else
|
||||||
|
if currentUser.isBoardMember
|
||||||
|
unless currentUser.isCommentOnly
|
||||||
|
+addListForm
|
||||||
each lists
|
each lists
|
||||||
if visible this
|
if visible this
|
||||||
+list(this)
|
+list(this)
|
||||||
if currentCardIsInThisList _id null
|
if currentCardIsInThisList _id null
|
||||||
+cardDetails(currentCard)
|
+cardDetails(currentCard)
|
||||||
if currentUser.isBoardMember
|
|
||||||
unless currentUser.isCommentOnly
|
|
||||||
+addListForm
|
|
||||||
|
|
||||||
template(name="addListForm")
|
template(name="addListForm")
|
||||||
.list.list-composer.js-list-composer
|
.list.list-composer.js-list-composer
|
||||||
|
|
|
||||||
|
|
@ -163,37 +163,11 @@ BlazeComponent.extendComponent({
|
||||||
// the user will legitimately expect to be able to select some text with
|
// the user will legitimately expect to be able to select some text with
|
||||||
// his mouse.
|
// his mouse.
|
||||||
|
|
||||||
if (Utils.isMiniScreen) {
|
const noDragInside = ['a', 'input', 'textarea', 'p'].concat(
|
||||||
const noDragInside = [
|
Util.isMiniScreen || (!Util.isMiniScreen && showDesktopDragHandles)
|
||||||
'a',
|
? ['.js-list-handle', '.js-swimlane-header-handle']
|
||||||
'input',
|
: ['.js-list-header'],
|
||||||
'textarea',
|
);
|
||||||
'p',
|
|
||||||
'.js-list-handle',
|
|
||||||
'.js-swimlane-header-handle',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Utils.isMiniScreen && !showDesktopDragHandles) {
|
|
||||||
const noDragInside = [
|
|
||||||
'a',
|
|
||||||
'input',
|
|
||||||
'textarea',
|
|
||||||
'p',
|
|
||||||
'.js-list-header',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Utils.isMiniScreen && showDesktopDragHandles) {
|
|
||||||
const noDragInside = [
|
|
||||||
'a',
|
|
||||||
'input',
|
|
||||||
'textarea',
|
|
||||||
'p',
|
|
||||||
'.js-list-handle',
|
|
||||||
'.js-swimlane-header-handle',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$(evt.target).closest(noDragInside.join(',')).length === 0 &&
|
$(evt.target).closest(noDragInside.join(',')).length === 0 &&
|
||||||
|
|
|
||||||
|
|
@ -409,6 +409,21 @@ Boards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
|
const enabled = Meteor.user().hasShowDesktopDragHandles();
|
||||||
|
return enabled ? this.draggableLists() : this.newestLists();
|
||||||
|
},
|
||||||
|
|
||||||
|
newestLists() {
|
||||||
|
// sorted lists from newest to the oldest, by its creation date or its cards' last modification date
|
||||||
|
return Lists.find(
|
||||||
|
{
|
||||||
|
boardId: this._id,
|
||||||
|
archived: false,
|
||||||
|
},
|
||||||
|
{ sort: { updatedAt: -1 } },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
draggableLists() {
|
||||||
return Lists.find({ boardId: this._id }, { sort: { sort: 1 } });
|
return Lists.find({ boardId: this._id }, { sort: { sort: 1 } });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1695,6 +1695,23 @@ if (Meteor.isServer) {
|
||||||
const oldvalue = doc[action] || '';
|
const oldvalue = doc[action] || '';
|
||||||
const activityType = `a-${action}`;
|
const activityType = `a-${action}`;
|
||||||
const card = Cards.findOne(doc._id);
|
const card = Cards.findOne(doc._id);
|
||||||
|
const list = card.list();
|
||||||
|
if (list) {
|
||||||
|
// change list modifiedAt
|
||||||
|
const modifiedAt = new Date();
|
||||||
|
const boardId = list.boardId;
|
||||||
|
Lists.direct.update(
|
||||||
|
{
|
||||||
|
_id: list._id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$set: {
|
||||||
|
modifiedAt,
|
||||||
|
boardId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
const username = Users.findOne(userId).username;
|
const username = Users.findOne(userId).username;
|
||||||
const activity = {
|
const activity = {
|
||||||
userId,
|
userId,
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,21 @@ Swimlanes.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
|
const enabled = Meteor.user().hasShowDesktopDragHandles();
|
||||||
|
return enabled ? this.draggableLists() : this.newestLists();
|
||||||
|
},
|
||||||
|
newestLists() {
|
||||||
|
// sorted lists from newest to the oldest, by its creation date or its cards' last modification date
|
||||||
|
return Lists.find(
|
||||||
|
{
|
||||||
|
boardId: this.boardId,
|
||||||
|
swimlaneId: { $in: [this._id, ''] },
|
||||||
|
archived: false,
|
||||||
|
},
|
||||||
|
{ sort: { updatedAt: -1 } },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
draggableLists() {
|
||||||
return Lists.find(
|
return Lists.find(
|
||||||
{
|
{
|
||||||
boardId: this.boardId,
|
boardId: this.boardId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue