mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 18:00:12 +01:00
Use Utils#getCurrentCard() everywhere in the code
This commit is contained in:
parent
7a6cfcb498
commit
fdf40f4584
10 changed files with 21 additions and 21 deletions
|
|
@ -15,7 +15,7 @@ BlazeComponent.extendComponent({
|
||||||
const capitalizedMode = Utils.capitalize(mode);
|
const capitalizedMode = Utils.capitalize(mode);
|
||||||
let thisId, searchId;
|
let thisId, searchId;
|
||||||
if (mode === 'linkedcard' || mode === 'linkedboard') {
|
if (mode === 'linkedcard' || mode === 'linkedboard') {
|
||||||
thisId = Session.get('currentCard');
|
thisId = Utils.getCurrentCardId();
|
||||||
searchId = Cards.findOne({ _id: thisId }).linkedId;
|
searchId = Cards.findOne({ _id: thisId }).linkedId;
|
||||||
mode = mode.replace('linked', '');
|
mode = mode.replace('linked', '');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ function resetCommentInput(input) {
|
||||||
// Tracker.autorun to register the component dependencies, and re-run when these
|
// Tracker.autorun to register the component dependencies, and re-run when these
|
||||||
// dependencies are invalidated. A better component API would remove this hack.
|
// dependencies are invalidated. A better component API would remove this hack.
|
||||||
Tracker.autorun(() => {
|
Tracker.autorun(() => {
|
||||||
Session.get('currentCard');
|
Utils.getCurrentCardId();
|
||||||
Tracker.afterFlush(() => {
|
Tracker.afterFlush(() => {
|
||||||
autosize.update($('.js-new-comment-input'));
|
autosize.update($('.js-new-comment-input'));
|
||||||
});
|
});
|
||||||
|
|
@ -75,7 +75,7 @@ EscapeActions.register(
|
||||||
() => {
|
() => {
|
||||||
const draftKey = {
|
const draftKey = {
|
||||||
fieldName: 'cardComment',
|
fieldName: 'cardComment',
|
||||||
docId: Session.get('currentCard'),
|
docId: Utils.getCurrentCardId(),
|
||||||
};
|
};
|
||||||
const commentInput = $('.js-new-comment-input');
|
const commentInput = $('.js-new-comment-input');
|
||||||
const draft = commentInput.val().trim();
|
const draft = commentInput.val().trim();
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
onlyShowCurrentCard() {
|
onlyShowCurrentCard() {
|
||||||
return Utils.isMiniScreen() && Session.get('currentCard');
|
return Utils.isMiniScreen() && Utils.getCurrentCardId();
|
||||||
},
|
},
|
||||||
|
|
||||||
goHome() {
|
goHome() {
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ BlazeComponent.extendComponent({
|
||||||
Sidebar.setView('search');
|
Sidebar.setView('search');
|
||||||
},
|
},
|
||||||
'click .js-multiselection-activate'() {
|
'click .js-multiselection-activate'() {
|
||||||
const currentCard = Session.get('currentCard');
|
const currentCard = Utils.getCurrentCardId();
|
||||||
MultiSelection.activate();
|
MultiSelection.activate();
|
||||||
if (currentCard) {
|
if (currentCard) {
|
||||||
MultiSelection.add(currentCard);
|
MultiSelection.add(currentCard);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import Cards from '/models/cards';
|
||||||
|
|
||||||
Template.cardCustomFieldsPopup.helpers({
|
Template.cardCustomFieldsPopup.helpers({
|
||||||
hasCustomField() {
|
hasCustomField() {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const customFieldId = this._id;
|
const customFieldId = this._id;
|
||||||
return card.customFieldIndex(customFieldId) > -1;
|
return card.customFieldIndex(customFieldId) > -1;
|
||||||
},
|
},
|
||||||
|
|
@ -11,7 +11,7 @@ Template.cardCustomFieldsPopup.helpers({
|
||||||
|
|
||||||
Template.cardCustomFieldsPopup.events({
|
Template.cardCustomFieldsPopup.events({
|
||||||
'click .js-select-field'(event) {
|
'click .js-select-field'(event) {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const customFieldId = this._id;
|
const customFieldId = this._id;
|
||||||
card.toggleCustomField(customFieldId);
|
card.toggleCustomField(customFieldId);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -31,7 +31,7 @@ const CardCustomField = BlazeComponent.extendComponent({
|
||||||
|
|
||||||
onCreated() {
|
onCreated() {
|
||||||
const self = this;
|
const self = this;
|
||||||
self.card = Cards.findOne(Session.get('currentCard'));
|
self.card = Utils.getCurrentCard();
|
||||||
self.customFieldId = this.data()._id;
|
self.customFieldId = this.data()._id;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -194,7 +194,7 @@ CardCustomField.register('cardCustomField');
|
||||||
onCreated() {
|
onCreated() {
|
||||||
super.onCreated();
|
super.onCreated();
|
||||||
const self = this;
|
const self = this;
|
||||||
self.card = Cards.findOne(Session.get('currentCard'));
|
self.card = Utils.getCurrentCard();
|
||||||
self.customFieldId = this.data()._id;
|
self.customFieldId = this.data()._id;
|
||||||
this.data().value && this.date.set(moment(this.data().value));
|
this.data().value && this.date.set(moment(this.data().value));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -806,7 +806,7 @@ Template.moveCardPopup.events({
|
||||||
'click .js-done'() {
|
'click .js-done'() {
|
||||||
// XXX We should *not* get the currentCard from the global state, but
|
// XXX We should *not* get the currentCard from the global state, but
|
||||||
// instead from a “component” state.
|
// instead from a “component” state.
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const bSelect = $('.js-select-boards')[0];
|
const bSelect = $('.js-select-boards')[0];
|
||||||
let boardId;
|
let boardId;
|
||||||
// if we are a worker, we won't have a board select so we just use the
|
// if we are a worker, we won't have a board select so we just use the
|
||||||
|
|
@ -864,7 +864,7 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.copyCardPopup.events({
|
Template.copyCardPopup.events({
|
||||||
'click .js-done'() {
|
'click .js-done'() {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const lSelect = $('.js-select-lists')[0];
|
const lSelect = $('.js-select-lists')[0];
|
||||||
const listId = lSelect.options[lSelect.selectedIndex].value;
|
const listId = lSelect.options[lSelect.selectedIndex].value;
|
||||||
const slSelect = $('.js-select-swimlanes')[0];
|
const slSelect = $('.js-select-swimlanes')[0];
|
||||||
|
|
@ -893,7 +893,7 @@ Template.copyCardPopup.events({
|
||||||
|
|
||||||
Template.convertChecklistItemToCardPopup.events({
|
Template.convertChecklistItemToCardPopup.events({
|
||||||
'click .js-done'() {
|
'click .js-done'() {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const lSelect = $('.js-select-lists')[0];
|
const lSelect = $('.js-select-lists')[0];
|
||||||
const listId = lSelect.options[lSelect.selectedIndex].value;
|
const listId = lSelect.options[lSelect.selectedIndex].value;
|
||||||
const slSelect = $('.js-select-swimlanes')[0];
|
const slSelect = $('.js-select-swimlanes')[0];
|
||||||
|
|
@ -921,7 +921,7 @@ Template.convertChecklistItemToCardPopup.events({
|
||||||
|
|
||||||
Template.copyChecklistToManyCardsPopup.events({
|
Template.copyChecklistToManyCardsPopup.events({
|
||||||
'click .js-done'() {
|
'click .js-done'() {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const oldId = card._id;
|
const oldId = card._id;
|
||||||
card._id = null;
|
card._id = null;
|
||||||
const lSelect = $('.js-select-lists')[0];
|
const lSelect = $('.js-select-lists')[0];
|
||||||
|
|
@ -1040,7 +1040,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
cards() {
|
cards() {
|
||||||
const currentId = Session.get('currentCard');
|
const currentId = Utils.getCurrentCardId();
|
||||||
if (this.parentBoard.get()) {
|
if (this.parentBoard.get()) {
|
||||||
return Cards.find({
|
return Cards.find({
|
||||||
boardId: this.parentBoard.get(),
|
boardId: this.parentBoard.get(),
|
||||||
|
|
@ -1706,7 +1706,7 @@ Template.cardAssigneesPopup.onCreated(function () {
|
||||||
|
|
||||||
Template.cardAssigneesPopup.events({
|
Template.cardAssigneesPopup.events({
|
||||||
'click .js-select-assignee'(event) {
|
'click .js-select-assignee'(event) {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const assigneeId = this.userId;
|
const assigneeId = this.userId;
|
||||||
card.toggleAssignee(assigneeId);
|
card.toggleAssignee(assigneeId);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ Template.editor.onRendered(() => {
|
||||||
const $summernote = getSummernote(this);
|
const $summernote = getSummernote(this);
|
||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
const image = files[0];
|
const image = files[0];
|
||||||
const currentCard = Cards.findOne(Session.get('currentCard'));
|
const currentCard = Utils.getCurrentCard();
|
||||||
const MAX_IMAGE_PIXEL = Utils.MAX_IMAGE_PIXEL;
|
const MAX_IMAGE_PIXEL = Utils.MAX_IMAGE_PIXEL;
|
||||||
const COMPRESS_RATIO = Utils.IMAGE_COMPRESS_RATIO;
|
const COMPRESS_RATIO = Utils.IMAGE_COMPRESS_RATIO;
|
||||||
const insertImage = src => {
|
const insertImage = src => {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function currentListIsInThisSwimlane(swimlaneId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentCardIsInThisList(listId, swimlaneId) {
|
function currentCardIsInThisList(listId, swimlaneId) {
|
||||||
const currentCard = Cards.findOne(Session.get('currentCard'));
|
const currentCard = Utils.getCurrentCard();
|
||||||
const currentUser = Meteor.user();
|
const currentUser = Meteor.user();
|
||||||
if (
|
if (
|
||||||
currentUser &&
|
currentUser &&
|
||||||
|
|
@ -125,7 +125,7 @@ BlazeComponent.extendComponent({
|
||||||
const boardComponent = this.parentComponent();
|
const boardComponent = this.parentComponent();
|
||||||
const $listsDom = this.$('.js-lists');
|
const $listsDom = this.$('.js-lists');
|
||||||
|
|
||||||
if (!Session.get('currentCard')) {
|
if (!Utils.getCurrentCardId()) {
|
||||||
boardComponent.scrollLeft();
|
boardComponent.scrollLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -284,7 +284,7 @@ BlazeComponent.extendComponent({
|
||||||
const boardComponent = this.parentComponent();
|
const boardComponent = this.parentComponent();
|
||||||
const $listsDom = this.$('.js-lists');
|
const $listsDom = this.$('.js-lists');
|
||||||
|
|
||||||
if (!Session.get('currentCard')) {
|
if (!Utils.getCurrentCardId()) {
|
||||||
boardComponent.scrollLeft();
|
boardComponent.scrollLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ Template.cardMembersPopup.helpers({
|
||||||
|
|
||||||
Template.cardMembersPopup.events({
|
Template.cardMembersPopup.events({
|
||||||
'click .js-select-member'(event) {
|
'click .js-select-member'(event) {
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
const card = Utils.getCurrentCard();
|
||||||
const memberId = this.userId;
|
const memberId = this.userId;
|
||||||
card.toggleMember(memberId);
|
card.toggleMember(memberId);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ Mousetrap.bind('/', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Mousetrap.bind(['down', 'up'], (evt, key) => {
|
Mousetrap.bind(['down', 'up'], (evt, key) => {
|
||||||
if (!Session.get('currentCard')) {
|
if (!Utils.getCurrentCardId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue