minicard.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 {
  37. if (cookies.has('showDesktopDragHandles')) {
  38. return true;
  39. } else {
  40. return false;
  41. }
  42. }
  43. },
  44. hiddenMinicardLabelText() {
  45. currentUser = Meteor.user();
  46. if (currentUser) {
  47. return (currentUser.profile || {}).hiddenMinicardLabelText;
  48. } else {
  49. if (cookies.has('hiddenMinicardLabelText')) {
  50. return true;
  51. } else {
  52. return false;
  53. }
  54. }
  55. },
  56. });