this.autorun(() => {
		if (instance.useEmojis && instance.useEmojis.get()) {
			Tracker.afterFlush(() => $('#convertAsciiEmoji').show());
		} else {
			Tracker.afterFlush(() => $('#convertAsciiEmoji').hide());
		}
	});
Example #2
0
	this.autorun(() => {
		const { rid, onInputChanged, onResize } = Template.currentData();

		Tracker.afterFlush(() => {
			const input = this.find('.js-input-message');

			if (this.input === input) {
				return;
			}

			this.input = input;
			onInputChanged && onInputChanged(input);

			if (input && rid) {
				this.popupConfig.set({
					rid,
					getInput: () => input,
				});
			} else {
				this.popupConfig.set(null);
			}

			if (this.autogrow) {
				this.autogrow.destroy();
				this.autogrow = null;
			}

			if (!input) {
				return;
			}

			const shadow = this.find('.js-input-message-shadow');
			this.autogrow = setupAutogrow(input, shadow, onResize);
		});
	});
  template.autorun(() => {
    template.allowedKeyValues.get()

    Tracker.afterFlush(() => {
      template.$('select').val(template.value)
    })
  })
Example #4
0
        return Meteor.call('addQuestion', projectId, inputValue, tabId, function (err, faqId) {
          if (err) console.log(err)

          return Tracker.afterFlush(function () {
            $('#' + faqId).find('.summernote').summernote()
            return $('.note-editor').addClass('hidden')
          })
        })
Example #5
0
Template.avatarPrompt.onRendered(function() {
	Tracker.afterFlush(function() {
		if (!RocketChat.settings.get('Accounts_AllowUserAvatarChange')) {
			FlowRouter.go('home');
		}
		SideNav.setFlex('accountFlex');
		SideNav.openFlex();
	});
});
Example #6
0
			}, (err) => {
				if (err && err.error) {
					return Materialize.toast(err.error, 4000);
				}

				Materialize.toast('Proyecto borrado exitosamente', 4000);
				instance.selectedProject.set('');
				Tracker.afterFlush(() => {
					$('select').material_select();
				});
			});
Example #7
0
			}, (err) => {
				if (err && err.error) {
					return Materialize.toast(err.error, 4000);
				}

				$('#platings').val('');
				$('#plating').val('');
				Materialize.toast('Datos de enchape actualizados exitosamente', 4000);
				Tracker.afterFlush(() => {
					$('select').material_select();
				});
			});
Example #8
0
  return this.autorun(function () {
    const handle = ProjectSubs.subscribe('wiki', projectId)

    handle.ready(Tracker.afterFlush(function () {
      $('.nav-tabs > li').removeClass('active')
      $('.nav-tabs > li:first').addClass('active')
      $('.tab-content .tab-pane:first').addClass('active')
      $('.summernote').summernote()
      return $('.note-editor').addClass('hidden')
    }))

    return FileSubs.subscribe('files', projectId)
  })
Example #9
0
			}, (err) => {
				if (err && err.error) {
					return Materialize.toast(err.error, 4000);
				}

				Materialize.toast('Enchape borrado exitosamente', 4000);
				instance.selectedPlating.set('');
				$('#platings').val('');
				$('#plating').val('');
				Tracker.afterFlush(() => {
					$('select').material_select();
				});
			});
Example #10
0
      it('renders the correct list when routed to', done => {
        const list = Lists.findOne();
        FlowRouter.go('Lists.show', { _id: list._id });

        // Wait for the router change to take affect
        Tracker.afterFlush(catchAsync(done, () => {
          assert.equal($('.title-wrapper').html(), list.name);

          // Wait for all subscriptions triggered by this route to complete
          waitForSubscriptions(catchAsync(done, () => {
            assert.equal(Todos.find({ listId: list._id }).count(), 3);
            done();
          }));
        }));
      });
 this.autorun(() => {
   if (editing.get()) {
     $('.cmsblocks_editor').addClass('open');
     Tracker.afterFlush(() => {
       const $txt = $('.cmsblocks_editor textarea');
       $txt.each((i, t) => {
         const $t = $(t);
         $t.height('1', 'em');
         $t.height(t.scrollHeight);
       });
     });
   } else {
     $('.cmsblocks_editor').removeClass('open');
     $('.cmsblocks_editor').addClass('close');
     Meteor.setTimeout(() => {
       $('.cmsblocks_editor').removeClass('close');
     }, 500);
   }
 });
Example #12
0
    const afterInsert = (err, res) => {
      this.afterSave(err, res, cb);

      if (!err) {
        this.destroy();

        Tracker.afterFlush(() => {
          const newSubcard = ViewModel.findOne('Subcard', vm => vm._id && vm._id() === res);

          if (newSubcard) {
            newSubcard.subcard.closest('.modal').animate({
              scrollTop: newSubcard.subcard.position().top + 70,
            }, 500, 'swing');
          } else if ($parentFirstNode.length) {
            $parentFirstNode.closest('.modal').scrollTop($parentFirstNode.position().top + 20);
          }
        });
      }
    };
Example #13
0
this.parent().update({ typeId }, (err) =>
  Tracker.afterFlush(() =>
    this.expandCollapsed(this.riskId())));
Example #14
0
Template.integrationsNew.onRendered(() => {
	Tracker.afterFlush(() => {
		SideNav.setFlex('adminFlex');
		SideNav.openFlex();
	});
});
Example #15
0
Template.threads.onCreated(async function() {
	this.Threads = new Mongo.Collection(null);
	const { rid, mid, msg } = this.data;
	this.state = new ReactiveDict({
		rid,
		close: !!mid,
		loading: true,
		mid,
		thread: msg,
	});


	this.incLimit = () => {

		const { rid, limit } = Tracker.nonreactive(() => this.state.all());

		const count = this.Threads.find({ rid }).count();

		if (limit > count) {
			return;
		}

		this.state.set('limit', this.state.get('limit') + LIST_SIZE);
		this.loadMore();
	};

	this.loadMore = _.debounce(async () => {
		const { rid, limit } = Tracker.nonreactive(() => this.state.all());
		if (this.state.get('loading') === rid) {
			return;
		}


		this.state.set('loading', rid);
		const threads = await call('getThreadsList', { rid, limit: LIST_SIZE, skip: limit - LIST_SIZE });
		upsert(this.Threads, threads);
		// threads.forEach(({ _id, ...msg }) => this.Threads.upsert({ _id }, msg));
		this.state.set('loading', false);

	}, 500);

	Tracker.afterFlush(() => {
		this.autorun(async () => {
			const { rid, mid } = Template.currentData();

			this.state.set({
				close: !!mid,
				mid,
				rid,
			});
		});
	});

	this.autorun(() => {
		const rid = this.state.get('rid');
		this.rid = rid;
		this.state.set({
			limit: LIST_SIZE,
		});
		this.loadMore();
	});

	this.autorun(() => {
		const rid = this.state.get('rid');
		this.threadsObserve && this.threadsObserve.stop();
		this.threadsObserve = Messages.find({ rid, _updatedAt: { $gt: new Date() }, tcount: { $exists: true }, _hidden: { $ne: true } }).observe({
			added: ({ _id, ...message }) => {
				this.Threads.upsert({ _id }, message);
			}, // Update message to re-render DOM
			changed: ({ _id, ...message }) => {
				this.Threads.update({ _id }, message);
			}, // Update message to re-render DOM
			removed: ({ _id }) => {
				this.Threads.remove(_id);

				const mid = this.state.get('mid');
				if (_id === mid) {
					this.state.set('mid', null);
				}
			},
		});

		const alert = 'Unread';
		this.subscriptionObserve && this.subscriptionObserve.stop();
		this.subscriptionObserve = Subscriptions.find({ rid }, { fields: { tunread: 1 } }).observeChanges({
			added: (_id, { tunread }) => {
				tunread && tunread.length && this.Threads.update({ tmid: { $in: tunread } }, { $set: { alert } }, { multi: true });
			},
			changed: (id, { tunread = [] }) => {
				this.Threads.update({ alert, _id: { $nin: tunread } }, { $unset: { alert: 1 } }, { multi: true });
				tunread && tunread.length && this.Threads.update({ _id: { $in: tunread } }, { $set: { alert } }, { multi: true });
			},
		});
	});

	this.autorun(async () => {
		const mid = this.state.get('mid');
		return this.state.set('thread', mid && (Messages.findOne({ _id: mid }, { fields: { tcount: 0, tlm: 0, replies: 0, _updatedAt: 0 } }) || this.Threads.findOne({ _id: mid }, { fields: { tcount: 0, tlm: 0, replies: 0, _updatedAt: 0 } })));
	});
});
Template.adminImportHistory.onRendered(() => {
	Tracker.afterFlush(() => {
		SideNav.setFlex('adminFlex');
		SideNav.openFlex();
	});
});
Example #17
0
Template.adminRooms.onRendered(function() {
	Tracker.afterFlush(function() {
		SideNav.setFlex('adminFlex');
		SideNav.openFlex();
	});
});
Template.accountTokens.onRendered(function() {
	Tracker.afterFlush(function() {
		SideNav.setFlex('accountFlex');
		SideNav.openFlex();
	});
});
Example #19
0
Template.cloud.onRendered(() => {
	Tracker.afterFlush(() => {
		SideNav.setFlex('adminFlex');
		SideNav.openFlex();
	});
});
Example #20
0
Template.adminEmoji.onRendered(() =>
	Tracker.afterFlush(function() {
		SideNav.setFlex('adminFlex');
		SideNav.openFlex();
	})