mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 07:20:12 +01:00
Refactor imported -> linked in components
This commit is contained in:
parent
6adfcb3513
commit
f76d8e47a8
11 changed files with 52 additions and 53 deletions
|
|
@ -24,9 +24,9 @@ BlazeComponent.extendComponent({
|
||||||
const card = this.currentData();
|
const card = this.currentData();
|
||||||
let boardId = card.boardId;
|
let boardId = card.boardId;
|
||||||
let cardId = card._id;
|
let cardId = card._id;
|
||||||
if (card.isImportedCard()) {
|
if (card.isLinkedCard()) {
|
||||||
boardId = Cards.findOne(card.importedId).boardId;
|
boardId = Cards.findOne(card.linkedId).boardId;
|
||||||
cardId = card.importedId;
|
cardId = card.linkedId;
|
||||||
}
|
}
|
||||||
if (text) {
|
if (text) {
|
||||||
CardComments.insert({
|
CardComments.insert({
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,9 @@ Template.cardAttachmentsPopup.events({
|
||||||
const card = this;
|
const card = this;
|
||||||
FS.Utility.eachFile(evt, (f) => {
|
FS.Utility.eachFile(evt, (f) => {
|
||||||
const file = new FS.File(f);
|
const file = new FS.File(f);
|
||||||
if (card.isImportedCard()) {
|
if (card.isLinkedCard()) {
|
||||||
file.boardId = Cards.findOne(card.importedId).boardId;
|
file.boardId = Cards.findOne(card.linkedId).boardId;
|
||||||
file.cardId = card.importedId;
|
file.cardId = card.linkedId;
|
||||||
} else {
|
} else {
|
||||||
file.boardId = card.boardId;
|
file.boardId = card.boardId;
|
||||||
file.cardId = card._id;
|
file.cardId = card._id;
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@ template(name="cardDetails")
|
||||||
a.js-parent-card(href=linkForCard) {{title}}
|
a.js-parent-card(href=linkForCard) {{title}}
|
||||||
// else
|
// else
|
||||||
{{_ 'top-level-card'}}
|
{{_ 'top-level-card'}}
|
||||||
if isImportedCard
|
if isLinkedCard
|
||||||
h3.imported-card-location
|
h3.linked-card-location
|
||||||
+viewer
|
+viewer
|
||||||
| {{getBoardTitle}} > {{getTitle}}
|
| {{getBoardTitle}} > {{getTitle}}
|
||||||
|
|
||||||
if getArchived
|
if getArchived
|
||||||
if isImportedBoard
|
if isLinkedBoard
|
||||||
p.warning {{_ 'board-archived'}}
|
p.warning {{_ 'board-archived'}}
|
||||||
else
|
else
|
||||||
p.warning {{_ 'card-archived'}}
|
p.warning {{_ 'card-archived'}}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
margin: 7px 0 0
|
margin: 7px 0 0
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
.imported-card-location
|
.linked-card-location
|
||||||
font-style: italic
|
font-style: italic
|
||||||
font-size: 1em
|
font-size: 1em
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ BlazeComponent.extendComponent({
|
||||||
const title = textarea.value.trim();
|
const title = textarea.value.trim();
|
||||||
let cardId = this.currentData().cardId;
|
let cardId = this.currentData().cardId;
|
||||||
const card = Cards.findOne(cardId);
|
const card = Cards.findOne(cardId);
|
||||||
if (card.isImported())
|
if (card.isLinked())
|
||||||
cardId = card.importedId;
|
cardId = card.linkedId;
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
Checklists.insert({
|
Checklists.insert({
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
template(name="minicard")
|
template(name="minicard")
|
||||||
.minicard(
|
.minicard(
|
||||||
class="{{#if isImportedCard}}imported-card{{/if}}"
|
class="{{#if isLinkedCard}}linked-card{{/if}}"
|
||||||
class="{{#if isImportedBoard}}imported-board{{/if}}")
|
class="{{#if isLinkedBoard}}linked-board{{/if}}")
|
||||||
if cover
|
if cover
|
||||||
.minicard-cover(style="background-image: url('{{cover.url}}');")
|
.minicard-cover(style="background-image: url('{{cover.url}}');")
|
||||||
if labels
|
if labels
|
||||||
|
|
@ -15,15 +15,14 @@ template(name="minicard")
|
||||||
if $eq 'prefix-with-parent' currentBoard.presentParentTask
|
if $eq 'prefix-with-parent' currentBoard.presentParentTask
|
||||||
.parent-prefix
|
.parent-prefix
|
||||||
| {{ parentCardName }}
|
| {{ parentCardName }}
|
||||||
if isImportedBoard
|
if isLinkedBoard
|
||||||
a.js-imported-link
|
a.js-linked-link
|
||||||
span.imported-icon.fa.fa-folder
|
span.linked-icon.fa.fa-folder
|
||||||
else if isImportedCard
|
else if isLinkedCard
|
||||||
a.js-imported-link
|
a.js-linked-link
|
||||||
span.imported-icon.fa.fa-id-card
|
span.linked-icon.fa.fa-id-card
|
||||||
if getArchived
|
if getArchived
|
||||||
span.imported-icon.imported-archived.fa.fa-archive
|
span.linked-icon.linked-archived.fa.fa-archive
|
||||||
|
|
||||||
+viewer
|
+viewer
|
||||||
= getTitle
|
= getTitle
|
||||||
if $eq 'subtext-with-full-path' currentBoard.presentParentTask
|
if $eq 'subtext-with-full-path' currentBoard.presentParentTask
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
'click .js-imported-link' (evt) {
|
'click .js-linked-link' (evt) {
|
||||||
if (this.data().isImportedCard())
|
if (this.data().isLinkedCard())
|
||||||
Utils.goCardId(this.data().importedId);
|
Utils.goCardId(this.data().linkedId);
|
||||||
else if (this.data().isImportedBoard())
|
else if (this.data().isLinkedBoard())
|
||||||
Utils.goBoardId(this.data().importedId);
|
Utils.goBoardId(this.data().linkedId);
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,14 @@
|
||||||
transition: transform 0.2s,
|
transition: transform 0.2s,
|
||||||
border-radius 0.2s
|
border-radius 0.2s
|
||||||
|
|
||||||
&.imported-board
|
&.linked-board
|
||||||
&.imported-card
|
&.linked-card
|
||||||
.imported-icon
|
.linked-icon
|
||||||
display: inline-block
|
display: inline-block
|
||||||
margin-right: 11px
|
margin-right: 11px
|
||||||
vertical-align: baseline
|
vertical-align: baseline
|
||||||
font-size: 0.9em
|
font-size: 0.9em
|
||||||
.imported-archived
|
.linked-archived
|
||||||
color: #937760
|
color: #937760
|
||||||
|
|
||||||
.is-selected &
|
.is-selected &
|
||||||
|
|
|
||||||
|
|
@ -188,11 +188,11 @@
|
||||||
top: -@padding
|
top: -@padding
|
||||||
right: 17px
|
right: 17px
|
||||||
|
|
||||||
.import-board-wrapper
|
.link-board-wrapper
|
||||||
display: flex
|
display: flex
|
||||||
align-items: baseline
|
align-items: baseline
|
||||||
|
|
||||||
.js-import-board
|
.js-link-board
|
||||||
margin-left: 15px
|
margin-left: 15px
|
||||||
|
|
||||||
.search-card-results
|
.search-card-results
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ template(name="addCardForm")
|
||||||
button.primary.confirm(type="submit") {{_ 'add'}}
|
button.primary.confirm(type="submit") {{_ 'add'}}
|
||||||
span.quiet
|
span.quiet
|
||||||
| {{_ 'or'}}
|
| {{_ 'or'}}
|
||||||
a.js-import {{_ 'import'}}
|
a.js-link {{_ 'link'}}
|
||||||
span.quiet
|
span.quiet
|
||||||
|
|
|
|
||||||
| /
|
| /
|
||||||
|
|
@ -46,16 +46,16 @@ template(name="autocompleteLabelLine")
|
||||||
.minicard-label(class="card-label-{{colorName}}" title=labelName)
|
.minicard-label(class="card-label-{{colorName}}" title=labelName)
|
||||||
span(class="{{#if hasNoName}}quiet{{/if}}")= labelName
|
span(class="{{#if hasNoName}}quiet{{/if}}")= labelName
|
||||||
|
|
||||||
template(name="importCardPopup")
|
template(name="linkCardPopup")
|
||||||
label {{_ 'boards'}}:
|
label {{_ 'boards'}}:
|
||||||
.import-board-wrapper
|
.link-board-wrapper
|
||||||
select.js-select-boards
|
select.js-select-boards
|
||||||
each boards
|
each boards
|
||||||
if $eq _id currentBoard._id
|
if $eq _id currentBoard._id
|
||||||
option(value="{{_id}}" selected) {{_ 'current'}}
|
option(value="{{_id}}" selected) {{_ 'current'}}
|
||||||
else
|
else
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
input.primary.confirm.js-import-board(type="button" value="{{_ 'import'}}")
|
input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
|
||||||
|
|
||||||
label {{_ 'swimlanes'}}:
|
label {{_ 'swimlanes'}}:
|
||||||
select.js-select-swimlanes
|
select.js-select-swimlanes
|
||||||
|
|
@ -73,11 +73,11 @@ template(name="importCardPopup")
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
|
|
||||||
.edit-controls.clearfix
|
.edit-controls.clearfix
|
||||||
input.primary.confirm.js-done(type="button" value="{{_ 'import'}}")
|
input.primary.confirm.js-done(type="button" value="{{_ 'link'}}")
|
||||||
|
|
||||||
template(name="searchCardPopup")
|
template(name="searchCardPopup")
|
||||||
label {{_ 'boards'}}:
|
label {{_ 'boards'}}:
|
||||||
.import-board-wrapper
|
.link-board-wrapper
|
||||||
select.js-select-boards
|
select.js-select-boards
|
||||||
each boards
|
each boards
|
||||||
if $eq _id currentBoard._id
|
if $eq _id currentBoard._id
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ BlazeComponent.extendComponent({
|
||||||
events() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
keydown: this.pressKey,
|
keydown: this.pressKey,
|
||||||
'click .js-import': Popup.open('importCard'),
|
'click .js-link': Popup.open('linkCard'),
|
||||||
'click .js-search': Popup.open('searchCard'),
|
'click .js-search': Popup.open('searchCard'),
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
@ -338,8 +338,8 @@ BlazeComponent.extendComponent({
|
||||||
swimlaneId: this.selectedSwimlaneId.get(),
|
swimlaneId: this.selectedSwimlaneId.get(),
|
||||||
listId: this.selectedListId.get(),
|
listId: this.selectedListId.get(),
|
||||||
archived: false,
|
archived: false,
|
||||||
importedId: null,
|
linkedId: null,
|
||||||
_id: {$nin: this.board.cards().map((card) => { return card.importedId || card._id; })},
|
_id: {$nin: this.board.cards().map((card) => { return card.linkedId || card._id; })},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -356,7 +356,7 @@ BlazeComponent.extendComponent({
|
||||||
this.selectedListId.set($(evt.currentTarget).val());
|
this.selectedListId.set($(evt.currentTarget).val());
|
||||||
},
|
},
|
||||||
'click .js-done' (evt) {
|
'click .js-done' (evt) {
|
||||||
// IMPORT CARD
|
// LINK CARD
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
const _id = Cards.insert({
|
const _id = Cards.insert({
|
||||||
|
|
@ -365,14 +365,14 @@ BlazeComponent.extendComponent({
|
||||||
swimlaneId: this.swimlaneId,
|
swimlaneId: this.swimlaneId,
|
||||||
boardId: this.boardId,
|
boardId: this.boardId,
|
||||||
sort: Lists.findOne(this.listId).cards().count(),
|
sort: Lists.findOne(this.listId).cards().count(),
|
||||||
type: 'cardType-importedCard',
|
type: 'cardType-linkedCard',
|
||||||
importedId: $('.js-select-cards option:selected').val(),
|
linkedId: $('.js-select-cards option:selected').val(),
|
||||||
});
|
});
|
||||||
Filter.addException(_id);
|
Filter.addException(_id);
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
'click .js-import-board' (evt) {
|
'click .js-link-board' (evt) {
|
||||||
//IMPORT BOARD
|
//LINK BOARD
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
const impBoardId = $('.js-select-boards option:selected').val();
|
const impBoardId = $('.js-select-boards option:selected').val();
|
||||||
|
|
@ -382,15 +382,15 @@ BlazeComponent.extendComponent({
|
||||||
swimlaneId: this.swimlaneId,
|
swimlaneId: this.swimlaneId,
|
||||||
boardId: this.boardId,
|
boardId: this.boardId,
|
||||||
sort: Lists.findOne(this.listId).cards().count(),
|
sort: Lists.findOne(this.listId).cards().count(),
|
||||||
type: 'cardType-importedBoard',
|
type: 'cardType-linkedBoard',
|
||||||
importedId: impBoardId,
|
linkedId: impBoardId,
|
||||||
});
|
});
|
||||||
Filter.addException(_id);
|
Filter.addException(_id);
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
}).register('importCardPopup');
|
}).register('linkCardPopup');
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
mixins() {
|
mixins() {
|
||||||
|
|
@ -452,7 +452,7 @@ BlazeComponent.extendComponent({
|
||||||
this.term.set(evt.target.searchTerm.value);
|
this.term.set(evt.target.searchTerm.value);
|
||||||
},
|
},
|
||||||
'click .js-minicard'(evt) {
|
'click .js-minicard'(evt) {
|
||||||
// IMPORT CARD
|
// LINK CARD
|
||||||
const card = Blaze.getData(evt.currentTarget);
|
const card = Blaze.getData(evt.currentTarget);
|
||||||
const _id = Cards.insert({
|
const _id = Cards.insert({
|
||||||
title: card.title, //dummy
|
title: card.title, //dummy
|
||||||
|
|
@ -460,8 +460,8 @@ BlazeComponent.extendComponent({
|
||||||
swimlaneId: this.swimlaneId,
|
swimlaneId: this.swimlaneId,
|
||||||
boardId: this.boardId,
|
boardId: this.boardId,
|
||||||
sort: Lists.findOne(this.listId).cards().count(),
|
sort: Lists.findOne(this.listId).cards().count(),
|
||||||
type: 'cardType-importedCard',
|
type: 'cardType-linkedCard',
|
||||||
importedId: card._id,
|
linkedId: card._id,
|
||||||
});
|
});
|
||||||
Filter.addException(_id);
|
Filter.addException(_id);
|
||||||
Popup.close();
|
Popup.close();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue