mirror of
https://github.com/wekan/wekan.git
synced 2025-12-20 17:30:13 +01:00
Added Table View to My Cards
This commit is contained in:
parent
19c54720c6
commit
147a3d99cb
5 changed files with 180 additions and 21 deletions
|
|
@ -6,6 +6,16 @@ template(name="myCardsHeaderBar")
|
||||||
i.fa.fa-list
|
i.fa.fa-list
|
||||||
| {{_ 'my-cards'}}
|
| {{_ 'my-cards'}}
|
||||||
|
|
||||||
|
.board-header-btns.left
|
||||||
|
a.board-header-btn.js-my-cards-view-change(title="{{_ 'myCardsViewChange-title'}}")
|
||||||
|
i.fa.fa-caret-down
|
||||||
|
if $eq myCardsView 'boards'
|
||||||
|
i.fa.fa-trello
|
||||||
|
| {{_ 'myCardsViewChange-choice-boards'}}
|
||||||
|
if $eq myCardsView 'table'
|
||||||
|
i.fa.fa-table
|
||||||
|
| {{_ 'myCardsViewChange-choice-table'}}
|
||||||
|
|
||||||
template(name="myCardsModalTitle")
|
template(name="myCardsModalTitle")
|
||||||
if currentUser
|
if currentUser
|
||||||
h2
|
h2
|
||||||
|
|
@ -17,6 +27,7 @@ template(name="myCards")
|
||||||
if searching.get
|
if searching.get
|
||||||
+spinner
|
+spinner
|
||||||
else
|
else
|
||||||
|
if $eq myCardsView 'boards'
|
||||||
.wrapper
|
.wrapper
|
||||||
each board in myCardsList
|
each board in myCardsList
|
||||||
.my-cards-board-wrapper
|
.my-cards-board-wrapper
|
||||||
|
|
@ -37,3 +48,68 @@ template(name="myCards")
|
||||||
.my-cards-card-wrapper
|
.my-cards-card-wrapper
|
||||||
a.minicard-wrapper(href=card.originRelativeUrl)
|
a.minicard-wrapper(href=card.originRelativeUrl)
|
||||||
+minicard(card)
|
+minicard(card)
|
||||||
|
if $eq myCardsView 'table'
|
||||||
|
.wrapper
|
||||||
|
table.my-cards-board-table
|
||||||
|
thead
|
||||||
|
th {{_ "Card"}}
|
||||||
|
th {{_ "List"}}
|
||||||
|
th {{_ "Board"}}
|
||||||
|
th {{_ "Swimlane"}}
|
||||||
|
unless isMiniScreen
|
||||||
|
th {{_ "Members"}}
|
||||||
|
th {{_ "Labels"}}
|
||||||
|
th {{_ "Due Date"}}
|
||||||
|
tbody
|
||||||
|
each board in myCardsList
|
||||||
|
each swimlane in board.mySwimlanes
|
||||||
|
each list in swimlane.myLists
|
||||||
|
each card in list.myCards
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
unless isMiniScreen
|
||||||
|
.my-cards-board-badge(class=board.colorClass, id="header")
|
||||||
|
.my-cards-card-title-table
|
||||||
|
a.minicard-wrapper(href=card.originRelativeUrl)
|
||||||
|
{{card.title}}
|
||||||
|
td
|
||||||
|
{{list.title}}
|
||||||
|
td
|
||||||
|
a(href=board.originRelativeUrl)
|
||||||
|
{{board.title}}
|
||||||
|
td
|
||||||
|
{{swimlane.title}}
|
||||||
|
|
||||||
|
unless isMiniScreen
|
||||||
|
td
|
||||||
|
.div
|
||||||
|
each member in card.members
|
||||||
|
a.name
|
||||||
|
+userAvatar(userId=member noRemove=true)
|
||||||
|
td
|
||||||
|
.div
|
||||||
|
each label in card.labelIds
|
||||||
|
span.card-label(class="card-label-{{labelColor board label}}" title=name)
|
||||||
|
{{labelName board label}}
|
||||||
|
td
|
||||||
|
if card.dueAt
|
||||||
|
{{ moment card.dueAt 'LLL' }}
|
||||||
|
|
||||||
|
template(name="myCardsViewChangePopup")
|
||||||
|
if currentUser
|
||||||
|
ul.pop-over-list
|
||||||
|
li
|
||||||
|
with "myCardsViewChange-choice-boards"
|
||||||
|
a.js-my-cards-view-boards
|
||||||
|
i.fa.fa-trello.colorful
|
||||||
|
| {{_ 'myCardsViewChange-choice-boards'}}
|
||||||
|
if $eq Utils.myCardsView "boards"
|
||||||
|
i.fa.fa-check
|
||||||
|
hr
|
||||||
|
li
|
||||||
|
with "myCardsViewChange-choice-table"
|
||||||
|
a.js-my-cards-view-table
|
||||||
|
i.fa.fa-table.colorful
|
||||||
|
| {{_ 'myCardsViewChange-choice-table'}}
|
||||||
|
if $eq Utils.myCardsView "table"
|
||||||
|
i.fa.fa-check
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,20 @@ BlazeComponent.extendComponent({
|
||||||
return Utils.myCardsSort();
|
return Utils.myCardsSort();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
myCardsView() {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
// console.log('sort:', Utils.myCardsView());
|
||||||
|
return Utils.myCardsView();
|
||||||
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'click .js-toggle-my-cards-choose-sort': Popup.open(
|
'click .js-toggle-my-cards-choose-sort': Popup.open(
|
||||||
'myCardsSortChange',
|
'myCardsSortChange',
|
||||||
),
|
),
|
||||||
|
'click .js-my-cards-view-change': Popup.open(
|
||||||
|
'myCardsViewChange'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
@ -24,6 +32,24 @@ Template.myCards.helpers({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'click .js-my-cards-view-boards'() {
|
||||||
|
Utils.setMyCardsView('boards');
|
||||||
|
Popup.back();
|
||||||
|
},
|
||||||
|
|
||||||
|
'click .js-my-cards-view-table'() {
|
||||||
|
Utils.setMyCardsView('table');
|
||||||
|
Popup.back();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}).register('myCardsViewChangePopup');
|
||||||
|
|
||||||
class MyCardsComponent extends CardSearchPagedComponent {
|
class MyCardsComponent extends CardSearchPagedComponent {
|
||||||
onCreated() {
|
onCreated() {
|
||||||
super.onCreated();
|
super.onCreated();
|
||||||
|
|
@ -41,6 +67,24 @@ class MyCardsComponent extends CardSearchPagedComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myCardsView() {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
//console.log('sort:', Utils.myCardsView());
|
||||||
|
return Utils.myCardsView();
|
||||||
|
}
|
||||||
|
|
||||||
|
labelName(board, labelId) {
|
||||||
|
const label = board.getLabelById(labelId)
|
||||||
|
const name = label.name
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
|
labelColor(board, labelId) {
|
||||||
|
const label = board.getLabelById(labelId)
|
||||||
|
const color = label.color
|
||||||
|
return color
|
||||||
|
}
|
||||||
|
|
||||||
myCardsList() {
|
myCardsList() {
|
||||||
const boards = [];
|
const boards = [];
|
||||||
let board = null;
|
let board = null;
|
||||||
|
|
|
||||||
|
|
@ -55,3 +55,23 @@
|
||||||
max-width: 500px
|
max-width: 500px
|
||||||
margin-right: auto
|
margin-right: auto
|
||||||
margin-left: auto
|
margin-left: auto
|
||||||
|
|
||||||
|
.my-cards-board-table
|
||||||
|
thead
|
||||||
|
border-bottom: 3px solid #4d4d4d
|
||||||
|
background-color: transparent
|
||||||
|
th, td
|
||||||
|
border: 0
|
||||||
|
tr
|
||||||
|
border-bottom: 2px solid #a2a2a2
|
||||||
|
|
||||||
|
.my-cards-card-title-table
|
||||||
|
font-weight: bold
|
||||||
|
padding-left: 2px
|
||||||
|
|
||||||
|
.my-cards-board-badge
|
||||||
|
width:36px
|
||||||
|
height:24px
|
||||||
|
float:left
|
||||||
|
border-radius:5px
|
||||||
|
margin-right: 5px
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,21 @@ Utils = {
|
||||||
Utils.reload();
|
Utils.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
myCardsView() {
|
||||||
|
let view = window.localStorage.getItem('myCardsView');
|
||||||
|
|
||||||
|
if (!view || !['boards', 'table'].includes(view)) {
|
||||||
|
view = 'boards';
|
||||||
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
|
},
|
||||||
|
|
||||||
|
setMyCardsView(view) {
|
||||||
|
window.localStorage.setItem('myCardsView', view);
|
||||||
|
Utils.reload();
|
||||||
|
},
|
||||||
|
|
||||||
// XXX We should remove these two methods
|
// XXX We should remove these two methods
|
||||||
goBoardId(_id) {
|
goBoardId(_id) {
|
||||||
const board = Boards.findOne(_id);
|
const board = Boards.findOne(_id);
|
||||||
|
|
|
||||||
|
|
@ -939,6 +939,10 @@
|
||||||
"list": "List",
|
"list": "List",
|
||||||
"board": "Board",
|
"board": "Board",
|
||||||
"context-separator": "/",
|
"context-separator": "/",
|
||||||
|
"myCardsViewChange-title": "My Cards View",
|
||||||
|
"myCardsViewChangePopup-title": "My Cards View",
|
||||||
|
"myCardsViewChange-choice-boards": "Boards",
|
||||||
|
"myCardsViewChange-choice-table": "Table",
|
||||||
"myCardsSortChange-title": "My Cards Sort",
|
"myCardsSortChange-title": "My Cards Sort",
|
||||||
"myCardsSortChangePopup-title": "My Cards Sort",
|
"myCardsSortChangePopup-title": "My Cards Sort",
|
||||||
"myCardsSortChange-choice-board": "By Board",
|
"myCardsSortChange-choice-board": "By Board",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue