<commit_before>import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { $ } from 'meteor/jquery';
import { i18n } from 'meteor/anti:i18n';
import { ReactiveVar } from 'meteor/reactive-var';

import pages from '../../../../api/pages/collection.js';

import './page.html';

Template.sitePage.onCreated(function sitePageOnCreated() {
  this.isContentReady = new ReactiveVar(false);
  const handle = this.subscribe('pages.all');
  this.autorun(() => {
    this.isContentReady.set(handle.ready());
  });
});

Template.sitePage.onRendered(function sitePageOnRendered() {
  this.autorun(() => {
    if (Session.get('siteContentFocus') && this.isContentReady.get()) {
      $(`.focus-${Session.get('siteContentFocus')}`).next().slideToggle();
    }
  });
});

Template.sitePage.helpers({

  page() {
    return pages.findOne({
      slug: Session.get('slug'),
      language: i18n.getLanguage(),
    });
  },

  slug() {
    return Session.get('slug');
  },

});

Template.sitePage.events({

  'click .toggle-link'(event) {
    const $toggleLink = $(event.currentTarget);
    $toggleLink.next().slideToggle();
  },

});<commit_msg>Added defer to handle linking into FAQ.<commit_after>import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { $ } from 'meteor/jquery';
import { i18n } from 'meteor/anti:i18n';
import { ReactiveVar } from 'meteor/reactive-var';
import { Meteor } from 'meteor/meteor';

import pages from '../../../../api/pages/collection.js';

import './page.html';

Template.sitePage.onCreated(function sitePageOnCreated() {
  this.isContentReady = new ReactiveVar(false);
  const handle = this.subscribe('pages.all');
  this.autorun(() => {
    this.isContentReady.set(handle.ready());
  });
});

Template.sitePage.onRendered(function sitePageOnRendered() {
  this.autorun(() => {
    if (Session.get('siteContentFocus') && this.isContentReady.get()) {
      Meteor.defer(() => {
        $(`.focus-${Session.get('siteContentFocus')}`).next().slideToggle();
      });
    }
  });
});

Template.sitePage.helpers({

  page() {
    return pages.findOne({
      slug: Session.get('slug'),
      language: i18n.getLanguage(),
    });
  },

  slug() {
    return Session.get('slug');
  },

});

Template.sitePage.events({

  'click .toggle-link'(event) {
    const $toggleLink = $(event.currentTarget);
    $toggleLink.next().slideToggle();
  },

});
{'fraction_non_alphanumeric': 0.19457013574660634, 'fraction_numerical': 0.0049362402303578775, 'mean_word_length': 3.7874015748031495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3384265', 'n_tokens_mistral': 818, 'n_tokens_neox': 800, 'n_words': 131}