mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Add sortDefault helper for sorting boards
This commit is contained in:
parent
9f396e9038
commit
10fcc19b7f
10 changed files with 50 additions and 31 deletions
|
|
@ -7,7 +7,7 @@ BlazeComponent.extendComponent({
|
||||||
return Boards.find(
|
return Boards.find(
|
||||||
{ archived: true },
|
{ archived: true },
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ }
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ Template.boardListHeaderBar.events({
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.boardListHeaderBar.helpers({
|
Template.boardListHeaderBar.helpers({
|
||||||
title(){
|
title() {
|
||||||
return FlowRouter.getRouteName() == 'home' ? 'my-boards' :'public';
|
return FlowRouter.getRouteName() == 'home' ? 'my-boards' : 'public';
|
||||||
},
|
},
|
||||||
templatesBoardId() {
|
templatesBoardId() {
|
||||||
return Meteor.user() && Meteor.user().getTemplatesBoardId();
|
return Meteor.user() && Meteor.user().getTemplatesBoardId();
|
||||||
|
|
@ -27,16 +27,12 @@ BlazeComponent.extendComponent({
|
||||||
let query = {
|
let query = {
|
||||||
archived: false,
|
archived: false,
|
||||||
type: 'board',
|
type: 'board',
|
||||||
}
|
};
|
||||||
if (FlowRouter.getRouteName() == 'home')
|
if (FlowRouter.getRouteName() == 'home')
|
||||||
query['members.userId'] = Meteor.userId()
|
query['members.userId'] = Meteor.userId();
|
||||||
else
|
else query.permission = 'public';
|
||||||
query.permission = 'public'
|
|
||||||
|
|
||||||
return Boards.find(
|
return Boards.find(query, { sort: { sort: 1 /* boards default sorting */ } });
|
||||||
query,
|
|
||||||
{ sort: ['title'] },
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
isStarred() {
|
isStarred() {
|
||||||
const user = Meteor.user();
|
const user = Meteor.user();
|
||||||
|
|
|
||||||
|
|
@ -727,7 +727,7 @@ BlazeComponent.extendComponent({
|
||||||
_id: { $ne: Meteor.user().getTemplatesBoardId() },
|
_id: { $ne: Meteor.user().getTemplatesBoardId() },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return boards;
|
return boards;
|
||||||
|
|
@ -903,7 +903,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return boards;
|
return boards;
|
||||||
|
|
@ -974,7 +974,7 @@ BlazeComponent.extendComponent({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click .js-delete': Popup.afterConfirm('cardDelete', function () {
|
'click .js-delete': Popup.afterConfirm('cardDelete', function() {
|
||||||
Popup.close();
|
Popup.close();
|
||||||
Cards.remove(this._id);
|
Cards.remove(this._id);
|
||||||
Utils.goBoardId(this.boardId);
|
Utils.goBoardId(this.boardId);
|
||||||
|
|
|
||||||
|
|
@ -411,7 +411,7 @@ BlazeComponent.extendComponent({
|
||||||
type: 'board',
|
type: 'board',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return boards;
|
return boards;
|
||||||
|
|
@ -597,7 +597,7 @@ BlazeComponent.extendComponent({
|
||||||
type: 'board',
|
type: 'board',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return boards;
|
return boards;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return boards;
|
return boards;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ BlazeComponent.extendComponent({
|
||||||
'members.isAdmin': true,
|
'members.isAdmin': true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -510,7 +510,7 @@ BlazeComponent.extendComponent({
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -589,7 +589,7 @@ BlazeComponent.extendComponent({
|
||||||
'subtext-with-parent',
|
'subtext-with-parent',
|
||||||
'no-parent',
|
'no-parent',
|
||||||
];
|
];
|
||||||
options.forEach(function (element) {
|
options.forEach(function(element) {
|
||||||
if (element !== value) {
|
if (element !== value) {
|
||||||
$(`#${element} ${MCB}`).toggleClass(CKCLS, false);
|
$(`#${element} ${MCB}`).toggleClass(CKCLS, false);
|
||||||
$(`#${element}`).toggleClass(CKCLS, false);
|
$(`#${element}`).toggleClass(CKCLS, false);
|
||||||
|
|
@ -688,7 +688,7 @@ BlazeComponent.extendComponent({
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1474,7 +1474,7 @@ if (Meteor.isServer) {
|
||||||
'members.userId': paramUserId,
|
'members.userId': paramUserId,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sort: ['title'],
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
).map(function(board) {
|
).map(function(board) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -1504,7 +1504,12 @@ if (Meteor.isServer) {
|
||||||
Authentication.checkUserId(req.userId);
|
Authentication.checkUserId(req.userId);
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Boards.find({ permission: 'public' }).map(function(doc) {
|
data: Boards.find(
|
||||||
|
{ permission: 'public' },
|
||||||
|
{
|
||||||
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
|
},
|
||||||
|
).map(function(doc) {
|
||||||
return {
|
return {
|
||||||
_id: doc._id,
|
_id: doc._id,
|
||||||
title: doc.title,
|
title: doc.title,
|
||||||
|
|
|
||||||
|
|
@ -386,12 +386,20 @@ if (Meteor.isClient) {
|
||||||
|
|
||||||
Users.helpers({
|
Users.helpers({
|
||||||
boards() {
|
boards() {
|
||||||
return Boards.find({ 'members.userId': this._id });
|
return Boards.find(
|
||||||
|
{ 'members.userId': this._id },
|
||||||
|
{ sort: { sort: 1 /* boards default sorting */ } },
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
starredBoards() {
|
starredBoards() {
|
||||||
const { starredBoards = [] } = this.profile || {};
|
const { starredBoards = [] } = this.profile || {};
|
||||||
return Boards.find({ archived: false, _id: { $in: starredBoards } });
|
return Boards.find(
|
||||||
|
{ archived: false, _id: { $in: starredBoards } },
|
||||||
|
{
|
||||||
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
hasStarred(boardId) {
|
hasStarred(boardId) {
|
||||||
|
|
@ -401,7 +409,12 @@ Users.helpers({
|
||||||
|
|
||||||
invitedBoards() {
|
invitedBoards() {
|
||||||
const { invitedBoards = [] } = this.profile || {};
|
const { invitedBoards = [] } = this.profile || {};
|
||||||
return Boards.find({ archived: false, _id: { $in: invitedBoards } });
|
return Boards.find(
|
||||||
|
{ archived: false, _id: { $in: invitedBoards } },
|
||||||
|
{
|
||||||
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
isInvitedTo(boardId) {
|
isInvitedTo(boardId) {
|
||||||
|
|
@ -1292,10 +1305,13 @@ if (Meteor.isServer) {
|
||||||
let data = Meteor.users.findOne({ _id: id });
|
let data = Meteor.users.findOne({ _id: id });
|
||||||
if (data !== undefined) {
|
if (data !== undefined) {
|
||||||
if (action === 'takeOwnership') {
|
if (action === 'takeOwnership') {
|
||||||
data = Boards.find({
|
data = Boards.find(
|
||||||
'members.userId': id,
|
{
|
||||||
'members.isAdmin': true,
|
'members.userId': id,
|
||||||
}).map(function(board) {
|
'members.isAdmin': true,
|
||||||
|
},
|
||||||
|
{ sort: { sort: 1 /* boards default sorting */ } },
|
||||||
|
).map(function(board) {
|
||||||
if (board.hasMember(req.userId)) {
|
if (board.hasMember(req.userId)) {
|
||||||
board.removeMember(req.userId);
|
board.removeMember(req.userId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ Meteor.publish('boards', function() {
|
||||||
permission: 1,
|
permission: 1,
|
||||||
type: 1,
|
type: 1,
|
||||||
},
|
},
|
||||||
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -61,6 +62,7 @@ Meteor.publish('archivedBoards', function() {
|
||||||
slug: 1,
|
slug: 1,
|
||||||
title: 1,
|
title: 1,
|
||||||
},
|
},
|
||||||
|
sort: { sort: 1 /* boards default sorting */ },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -90,7 +92,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
|
||||||
$or,
|
$or,
|
||||||
// Sort required to ensure oplog usage
|
// Sort required to ensure oplog usage
|
||||||
},
|
},
|
||||||
{ limit: 1, sort: { _id: 1 } },
|
{ limit: 1, sort: { sort: 1 /* boards default sorting */, _id: 1 } },
|
||||||
),
|
),
|
||||||
function(boardId, board) {
|
function(boardId, board) {
|
||||||
this.cursor(Lists.find({ boardId, archived: isArchived }));
|
this.cursor(Lists.find({ boardId, archived: isArchived }));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue