|  | @@ -34,15 +34,25 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |    onCreated() {
 | 
	
		
			
				|  |  |      this.currentBoard = Boards.findOne(Session.get('currentBoard'));
 | 
	
		
			
				|  |  |      this.isLoaded = new ReactiveVar(false);
 | 
	
		
			
				|  |  | -    const boardBody = this.parentComponent().parentComponent();
 | 
	
		
			
				|  |  | -    //in Miniview parent is Board, not BoardBody.
 | 
	
		
			
				|  |  | -    if (boardBody !== null) {
 | 
	
		
			
				|  |  | -      boardBody.showOverlay.set(true);
 | 
	
		
			
				|  |  | -      boardBody.mouseHasEnterCardDetails = false;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (this.parentComponent() && this.parentComponent().parentComponent()) {
 | 
	
		
			
				|  |  | +      const boardBody = this.parentComponent().parentComponent();
 | 
	
		
			
				|  |  | +      //in Miniview parent is Board, not BoardBody.
 | 
	
		
			
				|  |  | +      if (boardBody !== null) {
 | 
	
		
			
				|  |  | +        boardBody.showOverlay.set(true);
 | 
	
		
			
				|  |  | +        boardBody.mouseHasEnterCardDetails = false;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      this.calculateNextPeak();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      Meteor.subscribe('unsaved-edits');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // this.findUsersOptions = new ReactiveVar({});
 | 
	
		
			
				|  |  | +    // this.page = new ReactiveVar(1);
 | 
	
		
			
				|  |  | +    // this.autorun(() => {
 | 
	
		
			
				|  |  | +    //   const limitUsers = this.page.get() * Number.MAX_SAFE_INTEGER;
 | 
	
		
			
				|  |  | +    //   this.subscribe('people', this.findUsersOptions.get(), limitUsers, () => {});
 | 
	
		
			
				|  |  | +    // });
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    isWatching() {
 | 
	
	
		
			
				|  | @@ -54,6 +64,11 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |      return Meteor.user().hasHiddenSystemMessages();
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  customFieldsGrid() {
 | 
	
		
			
				|  |  | +    return Meteor.user().hasCustomFieldsGrid();
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    cardMaximized() {
 | 
	
		
			
				|  |  |      return Meteor.user().hasCardMaximized();
 | 
	
		
			
				|  |  |    },
 | 
	
	
		
			
				|  | @@ -180,7 +195,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              integration,
 | 
	
		
			
				|  |  |              'CardSelected',
 | 
	
		
			
				|  |  |              params,
 | 
	
		
			
				|  |  | -            () => {},
 | 
	
		
			
				|  |  | +            () => { },
 | 
	
		
			
				|  |  |            );
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |        }
 | 
	
	
		
			
				|  | @@ -203,7 +218,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |        distance: 7,
 | 
	
		
			
				|  |  |        start(evt, ui) {
 | 
	
		
			
				|  |  |          ui.placeholder.height(ui.helper.height());
 | 
	
		
			
				|  |  | -        EscapeActions.executeUpTo('popup-close');
 | 
	
		
			
				|  |  | +        EscapeActions.clickExecute(evt.target, 'inlinedForm');
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |        stop(evt, ui) {
 | 
	
		
			
				|  |  |          let prevChecklist = ui.item.prev('.js-checklist').get(0);
 | 
	
	
		
			
				|  | @@ -285,6 +300,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    onDestroyed() {
 | 
	
		
			
				|  |  | +    if (this.parentComponent() === null) return;
 | 
	
		
			
				|  |  |      const parentComponent = this.parentComponent().parentComponent();
 | 
	
		
			
				|  |  |      //on mobile view parent is Board, not board body.
 | 
	
		
			
				|  |  |      if (parentComponent === null) return;
 | 
	
	
		
			
				|  | @@ -307,30 +323,12 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |          'click .js-close-card-details'() {
 | 
	
		
			
				|  |  |            Utils.goBoardId(this.data().boardId);
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | -        'click .js-copy-link'() {
 | 
	
		
			
				|  |  | -          const StringToCopyElement = document.getElementById('cardURL_copy');
 | 
	
		
			
				|  |  | -          StringToCopyElement.value =
 | 
	
		
			
				|  |  | -            window.location.origin + window.location.pathname;
 | 
	
		
			
				|  |  | -          StringToCopyElement.select();
 | 
	
		
			
				|  |  | -          if (document.execCommand('copy')) {
 | 
	
		
			
				|  |  | -            StringToCopyElement.blur();
 | 
	
		
			
				|  |  | -          } else {
 | 
	
		
			
				|  |  | -            document.getElementById('cardURL_copy').selectionStart = 0;
 | 
	
		
			
				|  |  | -            document.getElementById('cardURL_copy').selectionEnd = 999;
 | 
	
		
			
				|  |  | -            document.execCommand('copy');
 | 
	
		
			
				|  |  | -            if (window.getSelection) {
 | 
	
		
			
				|  |  | -              if (window.getSelection().empty) {
 | 
	
		
			
				|  |  | -                // Chrome
 | 
	
		
			
				|  |  | -                window.getSelection().empty();
 | 
	
		
			
				|  |  | -              } else if (window.getSelection().removeAllRanges) {
 | 
	
		
			
				|  |  | -                // Firefox
 | 
	
		
			
				|  |  | -                window.getSelection().removeAllRanges();
 | 
	
		
			
				|  |  | -              }
 | 
	
		
			
				|  |  | -            } else if (document.selection) {
 | 
	
		
			
				|  |  | -              // IE?
 | 
	
		
			
				|  |  | -              document.selection.empty();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +        'click .js-copy-link'(event) {
 | 
	
		
			
				|  |  | +          event.preventDefault();
 | 
	
		
			
				|  |  | +          const promise = Utils.copyTextToClipboard(event.target.href);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          const $tooltip = this.$('.card-details-header .copied-tooltip');
 | 
	
		
			
				|  |  | +          Utils.showCopied(promise, $tooltip);
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          'click .js-open-card-details-menu': Popup.open('cardDetailsActions'),
 | 
	
		
			
				|  |  |          'submit .js-card-description'(event) {
 | 
	
	
		
			
				|  | @@ -365,6 +363,12 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              this.data().setRequestedBy('');
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | +        'keydown input.js-edit-card-sort'(evt) {
 | 
	
		
			
				|  |  | +          // enter = save
 | 
	
		
			
				|  |  | +          if (evt.keyCode === 13) {
 | 
	
		
			
				|  |  | +            this.find('button[type=submit]').click();
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  |          'submit .js-card-details-sort'(event) {
 | 
	
		
			
				|  |  |            event.preventDefault();
 | 
	
		
			
				|  |  |            const sort = parseFloat(this.currentComponent()
 | 
	
	
		
			
				|  | @@ -389,7 +393,9 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |          'click .js-end-date': Popup.open('editCardEndDate'),
 | 
	
		
			
				|  |  |          'click .js-show-positive-votes': Popup.open('positiveVoteMembers'),
 | 
	
		
			
				|  |  |          'click .js-show-negative-votes': Popup.open('negativeVoteMembers'),
 | 
	
		
			
				|  |  | +        'click .js-custom-fields': Popup.open('cardCustomFields'),
 | 
	
		
			
				|  |  |          'mouseenter .js-card-details'() {
 | 
	
		
			
				|  |  | +          if (this.parentComponent() === null) return;
 | 
	
		
			
				|  |  |            const parentComponent = this.parentComponent().parentComponent();
 | 
	
		
			
				|  |  |            //on mobile view parent is Board, not BoardBody.
 | 
	
		
			
				|  |  |            if (parentComponent === null) return;
 | 
	
	
		
			
				|  | @@ -412,6 +418,9 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |          'click #toggleButton'() {
 | 
	
		
			
				|  |  |            Meteor.call('toggleSystemMessages');
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | +        'click #toggleCustomFieldsGridButton'() {
 | 
	
		
			
				|  |  | +          Meteor.call('toggleCustomFieldsGrid');
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  |          'click .js-maximize-card-details'() {
 | 
	
		
			
				|  |  |            Meteor.call('toggleCardMaximized');
 | 
	
		
			
				|  |  |            autosize($('.card-details'));
 | 
	
	
		
			
				|  | @@ -511,6 +520,23 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  }).register('cardDetails');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +Template.cardDetails.helpers({
 | 
	
		
			
				|  |  | +  isPopup() {
 | 
	
		
			
				|  |  | +    let ret = !!Utils.getPopupCardId();
 | 
	
		
			
				|  |  | +    return ret;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +Template.cardDetailsPopup.onDestroyed(() => {
 | 
	
		
			
				|  |  | +  Session.delete('popupCardId');
 | 
	
		
			
				|  |  | +  Session.delete('popupCardBoardId');
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +Template.cardDetailsPopup.helpers({
 | 
	
		
			
				|  |  | +  popupCard() {
 | 
	
		
			
				|  |  | +    const ret = Utils.getPopupCard();
 | 
	
		
			
				|  |  | +    return ret;
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |    template() {
 | 
	
		
			
				|  |  |      return 'exportCard';
 | 
	
	
		
			
				|  | @@ -541,8 +567,8 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |  }).register('exportCardPopup');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // only allow number input
 | 
	
		
			
				|  |  | -Template.editCardSortOrderForm.onRendered(function() {
 | 
	
		
			
				|  |  | -  this.$('input').on("keypress paste", function(event) {
 | 
	
		
			
				|  |  | +Template.editCardSortOrderForm.onRendered(function () {
 | 
	
		
			
				|  |  | +  this.$('input').on("keypress paste", function (event) {
 | 
	
		
			
				|  |  |      let keyCode = event.keyCode;
 | 
	
		
			
				|  |  |      let charCode = String.fromCharCode(keyCode);
 | 
	
		
			
				|  |  |      let regex = new RegExp('[-0-9.]');
 | 
	
	
		
			
				|  | @@ -561,16 +587,15 @@ Template.editCardSortOrderForm.onRendered(function() {
 | 
	
		
			
				|  |  |        // XXX Recovering the currentCard identifier form a session variable is
 | 
	
		
			
				|  |  |        // fragile because this variable may change for instance if the route
 | 
	
		
			
				|  |  |        // change. We should use some component props instead.
 | 
	
		
			
				|  |  | -      docId: Session.get('currentCard'),
 | 
	
		
			
				|  |  | +      docId: Utils.getCurrentCardId(),
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    close(isReset = false) {
 | 
	
		
			
				|  |  |      if (this.isOpen.get() && !isReset) {
 | 
	
		
			
				|  |  |        const draft = this.getValue().trim();
 | 
	
		
			
				|  |  | -      if (
 | 
	
		
			
				|  |  | -        draft !== Cards.findOne(Session.get('currentCard')).getDescription()
 | 
	
		
			
				|  |  | -      ) {
 | 
	
		
			
				|  |  | +      let card = Utils.getCurrentCard();
 | 
	
		
			
				|  |  | +      if (card && draft !== card.getDescription()) {
 | 
	
		
			
				|  |  |          UnsavedEdits.set(this._getUnsavedEditKey(), this.getValue());
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -615,7 +640,6 @@ Template.cardDetailsActionsPopup.events({
 | 
	
		
			
				|  |  |    'click .js-export-card': Popup.open('exportCard'),
 | 
	
		
			
				|  |  |    'click .js-members': Popup.open('cardMembers'),
 | 
	
		
			
				|  |  |    'click .js-assignees': Popup.open('cardAssignees'),
 | 
	
		
			
				|  |  | -  'click .js-labels': Popup.open('cardLabels'),
 | 
	
		
			
				|  |  |    'click .js-attachments': Popup.open('cardAttachments'),
 | 
	
		
			
				|  |  |    'click .js-start-voting': Popup.open('cardStartVoting'),
 | 
	
		
			
				|  |  |    'click .js-start-planning-poker': Popup.open('cardStartPlanningPoker'),
 | 
	
	
		
			
				|  | @@ -634,25 +658,27 @@ Template.cardDetailsActionsPopup.events({
 | 
	
		
			
				|  |  |      event.preventDefault();
 | 
	
		
			
				|  |  |      const minOrder = _.min(
 | 
	
		
			
				|  |  |        this.list()
 | 
	
		
			
				|  |  | -        .cards(this.swimlaneId)
 | 
	
		
			
				|  |  | +        .cardsUnfiltered(this.swimlaneId)
 | 
	
		
			
				|  |  |          .map((c) => c.sort),
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      this.move(this.boardId, this.swimlaneId, this.listId, minOrder - 1);
 | 
	
		
			
				|  |  | +    Popup.back();
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    'click .js-move-card-to-bottom'(event) {
 | 
	
		
			
				|  |  |      event.preventDefault();
 | 
	
		
			
				|  |  |      const maxOrder = _.max(
 | 
	
		
			
				|  |  |        this.list()
 | 
	
		
			
				|  |  | -        .cards(this.swimlaneId)
 | 
	
		
			
				|  |  | +        .cardsUnfiltered(this.swimlaneId)
 | 
	
		
			
				|  |  |          .map((c) => c.sort),
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |      this.move(this.boardId, this.swimlaneId, this.listId, maxOrder + 1);
 | 
	
		
			
				|  |  | +    Popup.back();
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | -  'click .js-archive'(event) {
 | 
	
		
			
				|  |  | -    event.preventDefault();
 | 
	
		
			
				|  |  | -    this.archive();
 | 
	
		
			
				|  |  | +  'click .js-archive': Popup.afterConfirm('cardArchive', function () {
 | 
	
		
			
				|  |  |      Popup.close();
 | 
	
		
			
				|  |  | -  },
 | 
	
		
			
				|  |  | +    this.archive();
 | 
	
		
			
				|  |  | +    Utils.goBoardId(this.boardId);
 | 
	
		
			
				|  |  | +  }),
 | 
	
		
			
				|  |  |    'click .js-more': Popup.open('cardMore'),
 | 
	
		
			
				|  |  |    'click .js-toggle-watch-card'() {
 | 
	
		
			
				|  |  |      const currentCard = this;
 | 
	
	
		
			
				|  | @@ -667,6 +693,64 @@ Template.editCardTitleForm.onRendered(function () {
 | 
	
		
			
				|  |  |    autosize(this.$('.js-edit-card-title'));
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +Template.cardMembersPopup.onCreated(function () {
 | 
	
		
			
				|  |  | +  let currBoard = Boards.findOne(Session.get('currentBoard'));
 | 
	
		
			
				|  |  | +  let members = currBoard.activeMembers();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // let query = {
 | 
	
		
			
				|  |  | +  //   "teams.teamId": { $in: currBoard.teams.map(t => t.teamId) },
 | 
	
		
			
				|  |  | +  // };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // let boardTeamUsers = Users.find(query, {
 | 
	
		
			
				|  |  | +  //   sort: { sort: 1 },
 | 
	
		
			
				|  |  | +  // });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // members = currBoard.activeMembers2(members, boardTeamUsers);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  this.members = new ReactiveVar(members);
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +Template.cardMembersPopup.events({
 | 
	
		
			
				|  |  | +  'keyup .card-members-filter'(event) {
 | 
	
		
			
				|  |  | +    const members = filterMembers(event.target.value);
 | 
	
		
			
				|  |  | +    Template.instance().members.set(members);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +Template.cardMembersPopup.helpers({
 | 
	
		
			
				|  |  | +  members() {
 | 
	
		
			
				|  |  | +    return Template.instance().members.get();
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const filterMembers = (filterTerm) => {
 | 
	
		
			
				|  |  | +  let currBoard = Boards.findOne(Session.get('currentBoard'));
 | 
	
		
			
				|  |  | +  let members = currBoard.activeMembers();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // let query = {
 | 
	
		
			
				|  |  | +  //   "teams.teamId": { $in: currBoard.teams.map(t => t.teamId) },
 | 
	
		
			
				|  |  | +  // };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // let boardTeamUsers = Users.find(query, {
 | 
	
		
			
				|  |  | +  //   sort: { sort: 1 },
 | 
	
		
			
				|  |  | +  // });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // members = currBoard.activeMembers2(members, boardTeamUsers);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  if (filterTerm) {
 | 
	
		
			
				|  |  | +    members = members
 | 
	
		
			
				|  |  | +      .map(member => ({
 | 
	
		
			
				|  |  | +        member,
 | 
	
		
			
				|  |  | +        user: Users.findOne(member.userId)
 | 
	
		
			
				|  |  | +      }))
 | 
	
		
			
				|  |  | +      .filter(({ user }) =>
 | 
	
		
			
				|  |  | +      (user.profile.fullname !== undefined && user.profile.fullname.toLowerCase().indexOf(filterTerm.toLowerCase()) !== -1)
 | 
	
		
			
				|  |  | +      || user.profile.fullname === undefined && user.profile.username !== undefined && user.profile.username.toLowerCase().indexOf(filterTerm.toLowerCase()) !== -1)
 | 
	
		
			
				|  |  | +      .map(({ member }) => member);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  return members;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  Template.editCardTitleForm.events({
 | 
	
		
			
				|  |  |    'keydown .js-edit-card-title'(event) {
 | 
	
		
			
				|  |  |      // If enter key was pressed, submit the data
 | 
	
	
		
			
				|  | @@ -707,7 +791,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
 | 
	
	
		
			
				|  | @@ -719,7 +803,13 @@ Template.moveCardPopup.events({
 | 
	
		
			
				|  |  |      const slSelect = $('.js-select-swimlanes')[0];
 | 
	
		
			
				|  |  |      const swimlaneId = slSelect.options[slSelect.selectedIndex].value;
 | 
	
		
			
				|  |  |      card.move(boardId, swimlaneId, listId, 0);
 | 
	
		
			
				|  |  | -    Popup.close();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // set new id's to card object in case the card is moved to top by the comment "moveCard" after this command (.js-move-card)
 | 
	
		
			
				|  |  | +    this.boardId = boardId;
 | 
	
		
			
				|  |  | +    this.swimlaneId = swimlaneId;
 | 
	
		
			
				|  |  | +    this.listId = listId;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    Popup.back();
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  BlazeComponent.extendComponent({
 | 
	
	
		
			
				|  | @@ -765,7 +855,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];
 | 
	
	
		
			
				|  | @@ -787,14 +877,14 @@ Template.copyCardPopup.events({
 | 
	
		
			
				|  |  |        // See https://github.com/wekan/wekan/issues/80
 | 
	
		
			
				|  |  |        Filter.addException(_id);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -      Popup.close();
 | 
	
		
			
				|  |  | +      Popup.back();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  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];
 | 
	
	
		
			
				|  | @@ -814,7 +904,7 @@ Template.convertChecklistItemToCardPopup.events({
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        Filter.addException(_id);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -      Popup.close();
 | 
	
		
			
				|  |  | +      Popup.back();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
	
		
			
				|  | @@ -822,7 +912,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];
 | 
	
	
		
			
				|  | @@ -870,7 +960,7 @@ Template.copyChecklistToManyCardsPopup.events({
 | 
	
		
			
				|  |  |            cmt.copy(_id);
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      Popup.close();
 | 
	
		
			
				|  |  | +      Popup.back();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  });
 | 
	
	
		
			
				|  | @@ -941,7 +1031,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    cards() {
 | 
	
		
			
				|  |  | -    const currentId = Session.get('currentCard');
 | 
	
		
			
				|  |  | +    const currentId = Utils.getCurrentCardId();
 | 
	
		
			
				|  |  |      if (this.parentBoard.get()) {
 | 
	
		
			
				|  |  |        return Cards.find({
 | 
	
		
			
				|  |  |          boardId: this.parentBoard.get(),
 | 
	
	
		
			
				|  | @@ -980,30 +1070,11 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |    events() {
 | 
	
		
			
				|  |  |      return [
 | 
	
		
			
				|  |  |        {
 | 
	
		
			
				|  |  | -        'click .js-copy-card-link-to-clipboard'() {
 | 
	
		
			
				|  |  | -          // Clipboard code from:
 | 
	
		
			
				|  |  | -          // https://stackoverflow.com/questions/6300213/copy-selected-text-to-the-clipboard-without-using-flash-must-be-cross-browser
 | 
	
		
			
				|  |  | -          const StringToCopyElement = document.getElementById('cardURL');
 | 
	
		
			
				|  |  | -          StringToCopyElement.select();
 | 
	
		
			
				|  |  | -          if (document.execCommand('copy')) {
 | 
	
		
			
				|  |  | -            StringToCopyElement.blur();
 | 
	
		
			
				|  |  | -          } else {
 | 
	
		
			
				|  |  | -            document.getElementById('cardURL').selectionStart = 0;
 | 
	
		
			
				|  |  | -            document.getElementById('cardURL').selectionEnd = 999;
 | 
	
		
			
				|  |  | -            document.execCommand('copy');
 | 
	
		
			
				|  |  | -            if (window.getSelection) {
 | 
	
		
			
				|  |  | -              if (window.getSelection().empty) {
 | 
	
		
			
				|  |  | -                // Chrome
 | 
	
		
			
				|  |  | -                window.getSelection().empty();
 | 
	
		
			
				|  |  | -              } else if (window.getSelection().removeAllRanges) {
 | 
	
		
			
				|  |  | -                // Firefox
 | 
	
		
			
				|  |  | -                window.getSelection().removeAllRanges();
 | 
	
		
			
				|  |  | -              }
 | 
	
		
			
				|  |  | -            } else if (document.selection) {
 | 
	
		
			
				|  |  | -              // IE?
 | 
	
		
			
				|  |  | -              document.selection.empty();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +        'click .js-copy-card-link-to-clipboard'(event) {
 | 
	
		
			
				|  |  | +          const promise = Utils.copyTextToClipboard(location.origin + document.getElementById('cardURL').value);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          const $tooltip = this.$('.copied-tooltip');
 | 
	
		
			
				|  |  | +          Utils.showCopied(promise, $tooltip);
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          'click .js-delete': Popup.afterConfirm('cardDelete', function () {
 | 
	
		
			
				|  |  |            Popup.close();
 | 
	
	
		
			
				|  | @@ -1019,9 +1090,8 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              //   https://github.com/wekan/wekan/issues/2785
 | 
	
		
			
				|  |  |              const message = `${TAPi18n.__(
 | 
	
		
			
				|  |  |                'delete-linked-card-before-this-card',
 | 
	
		
			
				|  |  | -            )} linkedId: ${
 | 
	
		
			
				|  |  | -              this._id
 | 
	
		
			
				|  |  | -            } at client/components/cards/cardDetails.js and https://github.com/wekan/wekan/issues/2785`;
 | 
	
		
			
				|  |  | +            )} linkedId: ${this._id
 | 
	
		
			
				|  |  | +              } at client/components/cards/cardDetails.js and https://github.com/wekan/wekan/issues/2785`;
 | 
	
		
			
				|  |  |              alert(message);
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |            Utils.goBoardId(this.boardId);
 | 
	
	
		
			
				|  | @@ -1074,12 +1144,12 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |            if (endString) {
 | 
	
		
			
				|  |  |              this.currentCard.setVoteEnd(endString);
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  | -          Popup.close();
 | 
	
		
			
				|  |  | +          Popup.back();
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          'click .js-remove-vote': Popup.afterConfirm('deleteVote', () => {
 | 
	
		
			
				|  |  |            event.preventDefault();
 | 
	
		
			
				|  |  |            this.currentCard.unsetVote();
 | 
	
		
			
				|  |  | -          Popup.close();
 | 
	
		
			
				|  |  | +          Popup.back();
 | 
	
		
			
				|  |  |          }),
 | 
	
		
			
				|  |  |          'click a.js-toggle-vote-public'(event) {
 | 
	
		
			
				|  |  |            event.preventDefault();
 | 
	
	
		
			
				|  | @@ -1119,7 +1189,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              // if active vote -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getVoteQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(newDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  | +              Popup.back();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().vote = { end: newDate.toDate() }; // set vote end temp
 | 
	
		
			
				|  |  |                Popup.back();
 | 
	
	
		
			
				|  | @@ -1153,86 +1223,77 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(usaDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: usaDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (euroAmDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(euroAmDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: euroAmDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (euro24hDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(euro24hDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(euro24hDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: euro24hDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (eurodotDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(eurodotDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(eurodotDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: eurodotDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (minusDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(minusDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(minusDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: minusDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (slashDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(slashDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(slashDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: slashDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (dotDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(dotDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(dotDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: dotDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (brezhonegDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(brezhonegDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(brezhonegDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: brezhonegDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (hrvatskiDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(hrvatskiDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(hrvatskiDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: hrvatskiDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  |                Popup.back();
 | 
	
	
		
			
				|  | @@ -1242,41 +1303,37 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(latviaDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(latviaDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: latviaDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (nederlandsDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(nederlandsDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(nederlandsDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: nederlandsDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (greekDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(greekDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(greekDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: greekDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (macedonianDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(macedonianDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(macedonianDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: macedonianDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else {
 | 
	
		
			
				|  |  |              this.error.set('invalid-date');
 | 
	
		
			
				|  |  |              evt.target.date.focus();
 | 
	
	
		
			
				|  | @@ -1285,7 +1342,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |          'click .js-delete-date'(evt) {
 | 
	
		
			
				|  |  |            evt.preventDefault();
 | 
	
		
			
				|  |  |            this._deleteDate();
 | 
	
		
			
				|  |  | -          Popup.close();
 | 
	
		
			
				|  |  | +          Popup.back();
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |      ];
 | 
	
	
		
			
				|  | @@ -1323,11 +1380,11 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |            if (endString) {
 | 
	
		
			
				|  |  |              this.currentCard.setPokerEnd(endString);
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  | -          Popup.close();
 | 
	
		
			
				|  |  | +          Popup.back();
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          'click .js-remove-poker': Popup.afterConfirm('deletePoker', (event) => {
 | 
	
		
			
				|  |  |            this.currentCard.unsetPoker();
 | 
	
		
			
				|  |  | -          Popup.close();
 | 
	
		
			
				|  |  | +          Popup.back();
 | 
	
		
			
				|  |  |          }),
 | 
	
		
			
				|  |  |          'click a.js-toggle-poker-allow-non-members'(event) {
 | 
	
		
			
				|  |  |            event.preventDefault();
 | 
	
	
		
			
				|  | @@ -1390,7 +1447,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(newDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  | +              Popup.back();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: newDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  |                Popup.back();
 | 
	
	
		
			
				|  | @@ -1422,130 +1479,117 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(usaDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: usaDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (euroAmDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(euroAmDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: euroAmDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (euro24hDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(euro24hDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(euro24hDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: euro24hDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (eurodotDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(eurodotDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(eurodotDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: eurodotDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (minusDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(minusDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(minusDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: minusDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (slashDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(slashDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(slashDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: slashDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (dotDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(dotDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(dotDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: dotDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (brezhonegDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(brezhonegDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(brezhonegDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: brezhonegDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (hrvatskiDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(hrvatskiDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(hrvatskiDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: hrvatskiDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (latviaDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(latviaDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(latviaDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: latviaDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (nederlandsDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(nederlandsDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(nederlandsDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: nederlandsDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (greekDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(greekDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(greekDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: greekDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else if (macedonianDate.isValid()) {
 | 
	
		
			
				|  |  |              // if active poker -  store it
 | 
	
		
			
				|  |  |              if (this.currentData().getPokerQuestion()) {
 | 
	
		
			
				|  |  |                this._storeDate(macedonianDate.toDate());
 | 
	
		
			
				|  |  |                this.card.setPokerEnd(macedonianDate.toDate());
 | 
	
		
			
				|  |  | -              Popup.close();
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.currentData().poker = { end: macedonianDate.toDate() }; // set poker end temp
 | 
	
		
			
				|  |  | -              Popup.back();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            Popup.back();
 | 
	
		
			
				|  |  |            } else {
 | 
	
		
			
				|  |  |              // this.error.set('invalid-date);
 | 
	
		
			
				|  |  |              this.error.set('invalid-date' + ' ' + dateString);
 | 
	
	
		
			
				|  | @@ -1555,7 +1599,7 @@ BlazeComponent.extendComponent({
 | 
	
		
			
				|  |  |          'click .js-delete-date'(evt) {
 | 
	
		
			
				|  |  |            evt.preventDefault();
 | 
	
		
			
				|  |  |            this._deleteDate();
 | 
	
		
			
				|  |  | -          Popup.close();
 | 
	
		
			
				|  |  | +          Popup.back();
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |      ];
 | 
	
	
		
			
				|  | @@ -1589,13 +1633,34 @@ EscapeActions.register(
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +Template.cardAssigneesPopup.onCreated(function () {
 | 
	
		
			
				|  |  | +  let currBoard = Boards.findOne(Session.get('currentBoard'));
 | 
	
		
			
				|  |  | +  let members = currBoard.activeMembers();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // let query = {
 | 
	
		
			
				|  |  | +  //   "teams.teamId": { $in: currBoard.teams.map(t => t.teamId) },
 | 
	
		
			
				|  |  | +  // };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // let boardTeamUsers = Users.find(query, {
 | 
	
		
			
				|  |  | +  //   sort: { sort: 1 },
 | 
	
		
			
				|  |  | +  // });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // members = currBoard.activeMembers2(members, boardTeamUsers);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  this.members = new ReactiveVar(members);
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  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();
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  'keyup .card-assignees-filter'(event) {
 | 
	
		
			
				|  |  | +    const members = filterMembers(event.target.value);
 | 
	
		
			
				|  |  | +    Template.instance().members.set(members);
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  Template.cardAssigneesPopup.helpers({
 | 
	
	
		
			
				|  | @@ -1606,6 +1671,10 @@ Template.cardAssigneesPopup.helpers({
 | 
	
		
			
				|  |  |      return _.contains(cardAssignees, this.userId);
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  members() {
 | 
	
		
			
				|  |  | +    return Template.instance().members.get();
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    user() {
 | 
	
		
			
				|  |  |      return Users.findOne(this.userId);
 | 
	
		
			
				|  |  |    },
 | 
	
	
		
			
				|  | @@ -1657,7 +1726,7 @@ Template.cardAssigneePopup.helpers({
 | 
	
		
			
				|  |  |  Template.cardAssigneePopup.events({
 | 
	
		
			
				|  |  |    'click .js-remove-assignee'() {
 | 
	
		
			
				|  |  |      Cards.findOne(this.cardId).unassignAssignee(this.userId);
 | 
	
		
			
				|  |  | -    Popup.close();
 | 
	
		
			
				|  |  | +    Popup.back();
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    'click .js-edit-profile': Popup.open('editProfile'),
 | 
	
		
			
				|  |  |  });
 |