mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Development and fixes to My Cards and Due Cards
This commit is contained in:
parent
0e1c510948
commit
55b121e0d3
7 changed files with 50 additions and 108 deletions
|
|
@ -2,23 +2,22 @@ template(name="dueCardsHeaderBar")
|
|||
h1
|
||||
//a.back-btn(href="{{pathFor 'home'}}")
|
||||
// i.fa.fa-chevron-left
|
||||
| {{_ 'due-cards'}}
|
||||
| {{_ 'dueCards-title'}}
|
||||
|
||||
.board-header-btns.left
|
||||
a.board-header-btn.js-toggle-due-cards-choose-sort(title="{{_ 'due-cards-sort'}}")
|
||||
//i.fa.fa-caret-down
|
||||
i.fa.fa-sort
|
||||
if $eq dueCardsView 'user'
|
||||
i.fa.fa-th-large
|
||||
| {{_ 'due-cards-sort-board'}}
|
||||
a.board-header-btn.js-due-cards-view-change(title="{{_ 'dueCardsViewChange-title'}}")
|
||||
i.fa.fa-caret-down
|
||||
if $eq dueCardsView 'me'
|
||||
i.fa.fa-user
|
||||
| {{_ 'dueCardsViewChange-choice-me'}}
|
||||
if $eq dueCardsView 'all'
|
||||
i.fa.fa-calendar
|
||||
| {{_ 'due-cards-sort-dueat'}}
|
||||
i.fa.fa-users
|
||||
| {{_ 'dueCardsViewChange-choice-all'}}
|
||||
|
||||
template(name="dueCardsModalTitle")
|
||||
h2
|
||||
i.fa.fa-keyboard-o
|
||||
| {{_ 'due-cards'}}
|
||||
| {{_ 'dueCards-title'}}
|
||||
|
||||
template(name="dueCards")
|
||||
.wrapper
|
||||
|
|
@ -50,27 +49,16 @@ template(name="dueCards")
|
|||
template(name="dueCardsViewChangePopup")
|
||||
ul.pop-over-list
|
||||
li
|
||||
with "due-cards-view-user"
|
||||
a.js-due-cards-sort-board
|
||||
i.fa.fa-th-large.colorful
|
||||
| {{_ 'due-cards-view-user'}}
|
||||
if $eq Utils.dueCardsView "user"
|
||||
with "dueCardsViewChange-choice-me"
|
||||
a.js-due-cards-view-me
|
||||
i.fa.fa-user.colorful
|
||||
| {{_ 'dueCardsViewChange-choice-me'}}
|
||||
if $eq Utils.dueCardsView "me"
|
||||
i.fa.fa-check
|
||||
li
|
||||
with "due-cards-view-all"
|
||||
a.js-due-cards-sort-dueat
|
||||
i.fa.fa-calendar.colorful
|
||||
| {{_ 'due-cards-view-all'}}
|
||||
with "dueCardsViewChange-choice-all"
|
||||
a.js-due-cards-view-all
|
||||
i.fa.fa-users.colorful
|
||||
| {{_ 'dueCardsViewChange-choice-all'}}
|
||||
if $eq Utils.dueCardsView "all"
|
||||
i.fa.fa-check
|
||||
|
||||
//template(name="dueCardsViewChangePopup")
|
||||
// ul.pop-over-list
|
||||
// li
|
||||
// a.js-due-cards-sort-board
|
||||
// i.fa.fa-th-large.colorful
|
||||
// | {{_ 'due-cards-sort-board'}}
|
||||
// li
|
||||
// a.js-due-cards-sort-dueat
|
||||
// i.fa.fa-calendar.colorful
|
||||
// | {{_ 'due-cards-sort-dueat'}}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ BlazeComponent.extendComponent({
|
|||
events() {
|
||||
return [
|
||||
{
|
||||
'click .js-toggle-my-cards-choose-sort'() {
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('open sort');
|
||||
// Popup.open('dueCardsViewChange');
|
||||
Utils.dueCardsViewToggle();
|
||||
},
|
||||
'click .js-due-cards-view-change': Popup.open('dueCardsViewChange'),
|
||||
},
|
||||
];
|
||||
},
|
||||
|
|
@ -29,13 +24,13 @@ BlazeComponent.extendComponent({
|
|||
events() {
|
||||
return [
|
||||
{
|
||||
'click .js-my-cards-sort-board'() {
|
||||
Utils.setMyCardsSort('board');
|
||||
'click .js-due-cards-view-me'() {
|
||||
Utils.setDueCardsView('me');
|
||||
Popup.close();
|
||||
},
|
||||
|
||||
'click .js-my-cards-sort-dueat'() {
|
||||
Utils.setMyCardsSort('dueAt');
|
||||
'click .js-due-cards-view-all'() {
|
||||
Utils.setDueCardsView('all');
|
||||
Popup.close();
|
||||
},
|
||||
},
|
||||
|
|
@ -46,7 +41,7 @@ BlazeComponent.extendComponent({
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
Meteor.subscribe('setting');
|
||||
Meteor.subscribe('dueCards');
|
||||
Meteor.subscribe('dueCards', Utils.dueCardsView() === 'all');
|
||||
},
|
||||
|
||||
dueCardsView() {
|
||||
|
|
@ -60,7 +55,7 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
dueCardsList() {
|
||||
const allUsers = false;
|
||||
const allUsers = Utils.dueCardsView() === 'all';
|
||||
|
||||
const user = Meteor.user();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,15 +5,14 @@ template(name="myCardsHeaderBar")
|
|||
| {{_ 'my-cards'}}
|
||||
|
||||
.board-header-btns.left
|
||||
a.board-header-btn.js-toggle-my-cards-choose-sort(title="{{_ 'my-cards-sort'}}")
|
||||
//i.fa.fa-caret-down
|
||||
i.fa.fa-sort
|
||||
a.board-header-btn.js-toggle-my-cards-choose-sort(title="{{_ 'myCardsSortChange-title'}}")
|
||||
i.fa.fa-caret-down
|
||||
if $eq myCardsSort 'board'
|
||||
i.fa.fa-th-large
|
||||
| {{_ 'my-cards-sort-board'}}
|
||||
| {{_ 'myCardsSortChange-choice-board'}}
|
||||
if $eq myCardsSort 'dueAt'
|
||||
i.fa.fa-calendar
|
||||
| {{_ 'my-cards-sort-dueat'}}
|
||||
| {{_ 'myCardsSortChange-choice-dueat'}}
|
||||
|
||||
template(name="myCardsModalTitle")
|
||||
h2
|
||||
|
|
@ -73,24 +72,13 @@ template(name="myCardsSortChangePopup")
|
|||
with "my-cards-sort-board"
|
||||
a.js-my-cards-sort-board
|
||||
i.fa.fa-th-large.colorful
|
||||
| {{_ 'my-cards-sort-board'}}
|
||||
| {{_ 'myCardsSortChange-choice-board'}}
|
||||
if $eq Utils.myCardsSort "board"
|
||||
i.fa.fa-check
|
||||
li
|
||||
with "my-cards-sort-dueat"
|
||||
a.js-my-cards-sort-dueat
|
||||
i.fa.fa-calendar.colorful
|
||||
| {{_ 'my-cards-sort-dueat'}}
|
||||
| {{_ 'myCardsSortChange-choice-dueat'}}
|
||||
if $eq Utils.myCardsSort "dueAt"
|
||||
i.fa.fa-check
|
||||
|
||||
//template(name="myCardsSortChangePopup")
|
||||
// ul.pop-over-list
|
||||
// li
|
||||
// a.js-my-cards-sort-board
|
||||
// i.fa.fa-th-large.colorful
|
||||
// | {{_ 'my-cards-sort-board'}}
|
||||
// li
|
||||
// a.js-my-cards-sort-dueat
|
||||
// i.fa.fa-calendar.colorful
|
||||
// | {{_ 'my-cards-sort-dueat'}}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,9 @@ BlazeComponent.extendComponent({
|
|||
events() {
|
||||
return [
|
||||
{
|
||||
'click .js-toggle-my-cards-choose-sort'() {
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('open sort');
|
||||
// Popup.open('myCardsSortChange');
|
||||
Utils.myCardsSortToggle();
|
||||
},
|
||||
'click .js-toggle-my-cards-choose-sort': Popup.open(
|
||||
'myCardsSortChange',
|
||||
),
|
||||
},
|
||||
];
|
||||
},
|
||||
|
|
|
|||
|
|
@ -80,51 +80,18 @@ Utils = {
|
|||
dueCardsView() {
|
||||
let view = window.localStorage.getItem('dueCardsView');
|
||||
|
||||
if (!view || !['user', 'all'].includes(view)) {
|
||||
window.localStorage.setItem('dueCardsView', 'user');
|
||||
if (!view || !['me', 'all'].includes(view)) {
|
||||
window.localStorage.setItem('dueCardsView', 'me');
|
||||
location.reload();
|
||||
view = 'user';
|
||||
view = 'me';
|
||||
}
|
||||
|
||||
return view;
|
||||
},
|
||||
|
||||
dueBoardsSelector() {
|
||||
const user = Meteor.user();
|
||||
|
||||
const selector = {
|
||||
archived: false,
|
||||
};
|
||||
|
||||
// if user is not an admin allow her to see cards only from boards where
|
||||
// she is a member
|
||||
if (!user.isAdmin()) {
|
||||
selector.$or = [
|
||||
{ permission: 'public' },
|
||||
{ members: { $elemMatch: { userId: user._id, isActive: true } } },
|
||||
];
|
||||
}
|
||||
|
||||
return selector;
|
||||
},
|
||||
|
||||
dueCardsSelector() {
|
||||
const user = Meteor.user();
|
||||
|
||||
const selector = {
|
||||
archived: false,
|
||||
};
|
||||
|
||||
// if user is not an admin allow her to see cards only from boards where
|
||||
// she is a member
|
||||
if (!user.isAdmin()) {
|
||||
selector.$or = [
|
||||
{ permission: 'public' },
|
||||
{ members: { $elemMatch: { userId: user._id, isActive: true } } },
|
||||
];
|
||||
}
|
||||
|
||||
return selector;
|
||||
setDueCardsView(view) {
|
||||
window.localStorage.setItem('dueCardsView', view);
|
||||
location.reload();
|
||||
},
|
||||
|
||||
// XXX We should remove these two methods
|
||||
|
|
|
|||
|
|
@ -854,7 +854,11 @@
|
|||
"list": "List",
|
||||
"board": "Board",
|
||||
"context-separator": "/",
|
||||
"my-cards-sort": "My Cards Sort",
|
||||
"my-cards-sort-board": "By Board",
|
||||
"my-cards-sort-dueat": "By Due Date"
|
||||
"myCardsSortChange-title": "My Cards Sort",
|
||||
"myCardsSortChange-choice-board": "By Board",
|
||||
"myCardsSortChange-choice-dueat": "By Due Date",
|
||||
"dueCards-title": "Due Cards",
|
||||
"dueCardsViewChange-title": "Due Cards View",
|
||||
"dueCardsViewChange-choice-me": "Me",
|
||||
"dueCardsViewChange-choice-all": "All Users"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ Meteor.publish('myCards', function() {
|
|||
Meteor.publish('dueCards', function(allUsers = false) {
|
||||
check(allUsers, Boolean);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('all users:', allUsers);
|
||||
|
||||
const user = Users.findOne(this.userId);
|
||||
|
||||
const archivedBoards = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue