mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40: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
|
h1
|
||||||
//a.back-btn(href="{{pathFor 'home'}}")
|
//a.back-btn(href="{{pathFor 'home'}}")
|
||||||
// i.fa.fa-chevron-left
|
// i.fa.fa-chevron-left
|
||||||
| {{_ 'due-cards'}}
|
| {{_ 'dueCards-title'}}
|
||||||
|
|
||||||
.board-header-btns.left
|
.board-header-btns.left
|
||||||
a.board-header-btn.js-toggle-due-cards-choose-sort(title="{{_ 'due-cards-sort'}}")
|
a.board-header-btn.js-due-cards-view-change(title="{{_ 'dueCardsViewChange-title'}}")
|
||||||
//i.fa.fa-caret-down
|
i.fa.fa-caret-down
|
||||||
i.fa.fa-sort
|
if $eq dueCardsView 'me'
|
||||||
if $eq dueCardsView 'user'
|
i.fa.fa-user
|
||||||
i.fa.fa-th-large
|
| {{_ 'dueCardsViewChange-choice-me'}}
|
||||||
| {{_ 'due-cards-sort-board'}}
|
|
||||||
if $eq dueCardsView 'all'
|
if $eq dueCardsView 'all'
|
||||||
i.fa.fa-calendar
|
i.fa.fa-users
|
||||||
| {{_ 'due-cards-sort-dueat'}}
|
| {{_ 'dueCardsViewChange-choice-all'}}
|
||||||
|
|
||||||
template(name="dueCardsModalTitle")
|
template(name="dueCardsModalTitle")
|
||||||
h2
|
h2
|
||||||
i.fa.fa-keyboard-o
|
i.fa.fa-keyboard-o
|
||||||
| {{_ 'due-cards'}}
|
| {{_ 'dueCards-title'}}
|
||||||
|
|
||||||
template(name="dueCards")
|
template(name="dueCards")
|
||||||
.wrapper
|
.wrapper
|
||||||
|
|
@ -50,27 +49,16 @@ template(name="dueCards")
|
||||||
template(name="dueCardsViewChangePopup")
|
template(name="dueCardsViewChangePopup")
|
||||||
ul.pop-over-list
|
ul.pop-over-list
|
||||||
li
|
li
|
||||||
with "due-cards-view-user"
|
with "dueCardsViewChange-choice-me"
|
||||||
a.js-due-cards-sort-board
|
a.js-due-cards-view-me
|
||||||
i.fa.fa-th-large.colorful
|
i.fa.fa-user.colorful
|
||||||
| {{_ 'due-cards-view-user'}}
|
| {{_ 'dueCardsViewChange-choice-me'}}
|
||||||
if $eq Utils.dueCardsView "user"
|
if $eq Utils.dueCardsView "me"
|
||||||
i.fa.fa-check
|
i.fa.fa-check
|
||||||
li
|
li
|
||||||
with "due-cards-view-all"
|
with "dueCardsViewChange-choice-all"
|
||||||
a.js-due-cards-sort-dueat
|
a.js-due-cards-view-all
|
||||||
i.fa.fa-calendar.colorful
|
i.fa.fa-users.colorful
|
||||||
| {{_ 'due-cards-view-all'}}
|
| {{_ 'dueCardsViewChange-choice-all'}}
|
||||||
if $eq Utils.dueCardsView "all"
|
if $eq Utils.dueCardsView "all"
|
||||||
i.fa.fa-check
|
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() {
|
events() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'click .js-toggle-my-cards-choose-sort'() {
|
'click .js-due-cards-view-change': Popup.open('dueCardsViewChange'),
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
// console.log('open sort');
|
|
||||||
// Popup.open('dueCardsViewChange');
|
|
||||||
Utils.dueCardsViewToggle();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
@ -29,13 +24,13 @@ BlazeComponent.extendComponent({
|
||||||
events() {
|
events() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'click .js-my-cards-sort-board'() {
|
'click .js-due-cards-view-me'() {
|
||||||
Utils.setMyCardsSort('board');
|
Utils.setDueCardsView('me');
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
'click .js-my-cards-sort-dueat'() {
|
'click .js-due-cards-view-all'() {
|
||||||
Utils.setMyCardsSort('dueAt');
|
Utils.setDueCardsView('all');
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -46,7 +41,7 @@ BlazeComponent.extendComponent({
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
Meteor.subscribe('setting');
|
Meteor.subscribe('setting');
|
||||||
Meteor.subscribe('dueCards');
|
Meteor.subscribe('dueCards', Utils.dueCardsView() === 'all');
|
||||||
},
|
},
|
||||||
|
|
||||||
dueCardsView() {
|
dueCardsView() {
|
||||||
|
|
@ -60,7 +55,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
dueCardsList() {
|
dueCardsList() {
|
||||||
const allUsers = false;
|
const allUsers = Utils.dueCardsView() === 'all';
|
||||||
|
|
||||||
const user = Meteor.user();
|
const user = Meteor.user();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,14 @@ template(name="myCardsHeaderBar")
|
||||||
| {{_ 'my-cards'}}
|
| {{_ 'my-cards'}}
|
||||||
|
|
||||||
.board-header-btns.left
|
.board-header-btns.left
|
||||||
a.board-header-btn.js-toggle-my-cards-choose-sort(title="{{_ 'my-cards-sort'}}")
|
a.board-header-btn.js-toggle-my-cards-choose-sort(title="{{_ 'myCardsSortChange-title'}}")
|
||||||
//i.fa.fa-caret-down
|
i.fa.fa-caret-down
|
||||||
i.fa.fa-sort
|
|
||||||
if $eq myCardsSort 'board'
|
if $eq myCardsSort 'board'
|
||||||
i.fa.fa-th-large
|
i.fa.fa-th-large
|
||||||
| {{_ 'my-cards-sort-board'}}
|
| {{_ 'myCardsSortChange-choice-board'}}
|
||||||
if $eq myCardsSort 'dueAt'
|
if $eq myCardsSort 'dueAt'
|
||||||
i.fa.fa-calendar
|
i.fa.fa-calendar
|
||||||
| {{_ 'my-cards-sort-dueat'}}
|
| {{_ 'myCardsSortChange-choice-dueat'}}
|
||||||
|
|
||||||
template(name="myCardsModalTitle")
|
template(name="myCardsModalTitle")
|
||||||
h2
|
h2
|
||||||
|
|
@ -73,24 +72,13 @@ template(name="myCardsSortChangePopup")
|
||||||
with "my-cards-sort-board"
|
with "my-cards-sort-board"
|
||||||
a.js-my-cards-sort-board
|
a.js-my-cards-sort-board
|
||||||
i.fa.fa-th-large.colorful
|
i.fa.fa-th-large.colorful
|
||||||
| {{_ 'my-cards-sort-board'}}
|
| {{_ 'myCardsSortChange-choice-board'}}
|
||||||
if $eq Utils.myCardsSort "board"
|
if $eq Utils.myCardsSort "board"
|
||||||
i.fa.fa-check
|
i.fa.fa-check
|
||||||
li
|
li
|
||||||
with "my-cards-sort-dueat"
|
with "my-cards-sort-dueat"
|
||||||
a.js-my-cards-sort-dueat
|
a.js-my-cards-sort-dueat
|
||||||
i.fa.fa-calendar.colorful
|
i.fa.fa-calendar.colorful
|
||||||
| {{_ 'my-cards-sort-dueat'}}
|
| {{_ 'myCardsSortChange-choice-dueat'}}
|
||||||
if $eq Utils.myCardsSort "dueAt"
|
if $eq Utils.myCardsSort "dueAt"
|
||||||
i.fa.fa-check
|
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() {
|
events() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'click .js-toggle-my-cards-choose-sort'() {
|
'click .js-toggle-my-cards-choose-sort': Popup.open(
|
||||||
// eslint-disable-next-line no-console
|
'myCardsSortChange',
|
||||||
// console.log('open sort');
|
),
|
||||||
// Popup.open('myCardsSortChange');
|
|
||||||
Utils.myCardsSortToggle();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -80,51 +80,18 @@ Utils = {
|
||||||
dueCardsView() {
|
dueCardsView() {
|
||||||
let view = window.localStorage.getItem('dueCardsView');
|
let view = window.localStorage.getItem('dueCardsView');
|
||||||
|
|
||||||
if (!view || !['user', 'all'].includes(view)) {
|
if (!view || !['me', 'all'].includes(view)) {
|
||||||
window.localStorage.setItem('dueCardsView', 'user');
|
window.localStorage.setItem('dueCardsView', 'me');
|
||||||
location.reload();
|
location.reload();
|
||||||
view = 'user';
|
view = 'me';
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
},
|
},
|
||||||
|
|
||||||
dueBoardsSelector() {
|
setDueCardsView(view) {
|
||||||
const user = Meteor.user();
|
window.localStorage.setItem('dueCardsView', view);
|
||||||
|
location.reload();
|
||||||
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;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX We should remove these two methods
|
// XXX We should remove these two methods
|
||||||
|
|
|
||||||
|
|
@ -854,7 +854,11 @@
|
||||||
"list": "List",
|
"list": "List",
|
||||||
"board": "Board",
|
"board": "Board",
|
||||||
"context-separator": "/",
|
"context-separator": "/",
|
||||||
"my-cards-sort": "My Cards Sort",
|
"myCardsSortChange-title": "My Cards Sort",
|
||||||
"my-cards-sort-board": "By Board",
|
"myCardsSortChange-choice-board": "By Board",
|
||||||
"my-cards-sort-dueat": "By Due Date"
|
"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) {
|
Meteor.publish('dueCards', function(allUsers = false) {
|
||||||
check(allUsers, Boolean);
|
check(allUsers, Boolean);
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
// console.log('all users:', allUsers);
|
||||||
|
|
||||||
const user = Users.findOne(this.userId);
|
const user = Users.findOne(this.userId);
|
||||||
|
|
||||||
const archivedBoards = [];
|
const archivedBoards = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue