minicard.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { Cookies } from 'meteor/ostrio:cookies';
  2. const cookies = new Cookies();
  3. // Template.cards.events({
  4. // 'click .member': Popup.open('cardMember')
  5. // });
  6. BlazeComponent.extendComponent({
  7. template() {
  8. return 'minicard';
  9. },
  10. events() {
  11. return [
  12. {
  13. 'click .js-linked-link'() {
  14. if (this.data().isLinkedCard()) Utils.goCardId(this.data().linkedId);
  15. else if (this.data().isLinkedBoard())
  16. Utils.goBoardId(this.data().linkedId);
  17. },
  18. },
  19. {
  20. 'click .js-toggle-minicard-label-text'() {
  21. if (cookies.has('hiddenMinicardLabelText')) {
  22. cookies.remove('hiddenMinicardLabelText'); //true
  23. } else {
  24. cookies.set('hiddenMinicardLabelText', 'true'); //true
  25. }
  26. },
  27. },
  28. ];
  29. },
  30. }).register('minicard');
  31. Template.minicard.helpers({
  32. showDesktopDragHandles() {
  33. currentUser = Meteor.user();
  34. if (currentUser) {
  35. return (currentUser.profile || {}).showDesktopDragHandles;
  36. } else if (cookies.has('showDesktopDragHandles')) {
  37. return true;
  38. } else {
  39. return false;
  40. }
  41. },
  42. hiddenMinicardLabelText() {
  43. currentUser = Meteor.user();
  44. if (currentUser) {
  45. return (currentUser.profile || {}).hiddenMinicardLabelText;
  46. } else if (cookies.has('hiddenMinicardLabelText')) {
  47. return true;
  48. } else {
  49. return false;
  50. }
  51. },
  52. });