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