mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
Merge branch 'sort-feature' of https://github.com/ednamaeG/wekan into ednamaeG-sort-feature
This commit is contained in:
commit
70e7534933
3 changed files with 75 additions and 1 deletions
|
@ -31,6 +31,9 @@ template(name="boardHeaderBar")
|
|||
if $eq watchLevel "muted"
|
||||
i.fa.fa-bell-slash
|
||||
span {{_ watchLevel}}
|
||||
a.board-header-btn.js-sort-cards(title="Sort Cards")
|
||||
i.fa.fa-sort
|
||||
| Sort By {{sortCardsBy.get}}
|
||||
|
||||
else
|
||||
a.board-header-btn.js-log-in(
|
||||
|
@ -247,3 +250,19 @@ template(name="boardChangeTitlePopup")
|
|||
template(name="boardCreateRulePopup")
|
||||
p {{_ 'close-board-pop'}}
|
||||
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
|
||||
|
||||
|
||||
template(name="cardsSortPopup")
|
||||
ul.pop-over-list
|
||||
li
|
||||
a.js-sort-due Due Date
|
||||
hr
|
||||
li
|
||||
a.js-sort-title Title(Alphabetically)
|
||||
hr
|
||||
li
|
||||
a.js-sort-created-desc Created At(Newest First)
|
||||
hr
|
||||
li
|
||||
a.js-sort-created-asc Created At(Oldest First)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
const DOWNCLS = 'fa-sort-down';
|
||||
const UPCLS = 'fa-sort-up';
|
||||
*/
|
||||
const sortCardsBy = new ReactiveVar('')
|
||||
Template.boardMenuPopup.events({
|
||||
'click .js-rename-board': Popup.open('boardChangeTitle'),
|
||||
'click .js-custom-fields'() {
|
||||
|
@ -110,6 +111,7 @@ BlazeComponent.extendComponent({
|
|||
'click .js-open-filter-view'() {
|
||||
Sidebar.setView('filter');
|
||||
},
|
||||
'click .js-sort-cards': Popup.open('cardsSort'),
|
||||
/*
|
||||
'click .js-open-sort-view'(evt) {
|
||||
const target = evt.target;
|
||||
|
@ -368,3 +370,53 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
}).register('listsortPopup');
|
||||
*/
|
||||
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
'click .js-sort-due'() {
|
||||
const sortBy = {
|
||||
'dueAt': 1
|
||||
}
|
||||
Session.set('sortBy',sortBy)
|
||||
sortCardsBy.set('Due Date')
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-sort-title'() {
|
||||
const sortBy = {
|
||||
'title': 1
|
||||
}
|
||||
Session.set('sortBy',sortBy)
|
||||
sortCardsBy.set('Title')
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-sort-created-asc'() {
|
||||
const sortBy = {
|
||||
'createdAt': 1
|
||||
}
|
||||
Session.set('sortBy',sortBy)
|
||||
sortCardsBy.set('Date Created (Newest First)')
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-sort-created-desc'() {
|
||||
const sortBy = {
|
||||
'createdAt': -1
|
||||
}
|
||||
Session.set('sortBy',sortBy)
|
||||
sortCardsBy.set('Date Created (Oldest First)')
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-sort-default'() {
|
||||
const sortBy = {
|
||||
'sort': 1
|
||||
}
|
||||
Session.set('sortBy',sortBy)
|
||||
sortCardsBy.set('Default')
|
||||
Popup.close();
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
}).register('cardsSortPopup');
|
||||
|
|
|
@ -168,13 +168,16 @@ BlazeComponent.extendComponent({
|
|||
|
||||
cardsWithLimit(swimlaneId) {
|
||||
const limit = this.cardlimit.get();
|
||||
const defaultSort = { sort: 1 };
|
||||
const sortBy = Session.get('sortBy') ? Session.get('sortBy') : defaultSort;
|
||||
const selector = {
|
||||
listId: this.currentData()._id,
|
||||
archived: false,
|
||||
};
|
||||
if (swimlaneId) selector.swimlaneId = swimlaneId;
|
||||
return Cards.find(Filter.mongoSelector(selector), {
|
||||
sort: ['sort'],
|
||||
// sort: ['sort'],
|
||||
sort:sortBy,
|
||||
limit,
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue