<commit_before>Template.timeline.onCreated(function(){
  this.currentView = new ReactiveVar('week');
});

Template.timeline.helpers({
  strategicMilestone: function () {
    return Milestones.findOne({userId: Meteor.userId(), type: 'strategic'});
  },
  currentView: function(){
    return Template.instance().currentView.get();
  }
});

Template.timeline.events({
  'click .bar': function (e, t) {
    var newType = e.currentTarget.dataset.viewType;
    newType && t.currentView.set(newType);
  }
});

Template.milestoneAlt.events({
  'click .js-add-goal': function(e) {
    var data = { milestone: this.milestone }
    Blaze.renderWithData(Template._formModal, { title: 'Add Goal', template: '_goalsForm', data }, document.body);
  },
  'click .glyphicon-pencil': function(event) {
    let goalId = event.target.parentNode.parentNode.id;
    let data = {
      milestone: this.milestone,
      goalId: goalId,
    };
    Blaze.renderWithData(Template._formModal, {
      title: 'Edit Goal',
      template: '_editGoal',
      data
    }, document.body);
  },
});

Template.milestoneAlt.helpers({
  'getTitle': function() {
    var milestone = this.milestone;
    if (milestone){
      switch (milestone.type){
        case 'strategic':
          return 'Strategic';
        case 'year':
          return milestone.period
        case 'month':
          var monthNames = ["January", "February", "March", "April", "May", "June",
                "July", "August", "September", "October", "November", "December"
              ];
          var date = new Date(milestone.period);
          return monthNames[date.getMonth()]
        case 'week':
          return 'Week#' + moment(milestone.period, 'yyyy-ww').week();
      }
    }
  },
  'childType': function(){
    var type = this.milestone.type;
    switch (this.milestone.type){
      case 'strategic':
        return 'year';
      case 'year':
        return 'month';
      case 'month':
        return 'week';
    }
  }<commit_msg>Drop unused childType helper<commit_after>Template.timeline.onCreated(function(){
  this.currentView = new ReactiveVar('week');
});

Template.timeline.helpers({
  strategicMilestone: function () {
    return Milestones.findOne({userId: Meteor.userId(), type: 'strategic'});
  },
  currentView: function(){
    return Template.instance().currentView.get();
  }
});

Template.timeline.events({
  'click .bar': function (e, t) {
    var newType = e.currentTarget.dataset.viewType;
    newType && t.currentView.set(newType);
  }
});

Template.milestoneAlt.events({
  'click .js-add-goal': function(e) {
    var data = { milestone: this.milestone }
    Blaze.renderWithData(Template._formModal, { title: 'Add Goal', template: '_goalsForm', data }, document.body);
  },
  'click .glyphicon-pencil': function(event) {
    let goalId = event.target.parentNode.parentNode.id;
    let data = {
      milestone: this.milestone,
      goalId: goalId,
    };
    Blaze.renderWithData(Template._formModal, {
      title: 'Edit Goal',
      template: '_editGoal',
      data
    }, document.body);
  },
});

Template.milestoneAlt.helpers({
  'getTitle': function() {
    var milestone = this.milestone;
    if (milestone){
      switch (milestone.type){
        case 'strategic':
          return 'Strategic';
        case 'year':
          return milestone.period
        case 'month':
          var monthNames = ["January", "February", "March", "April", "May", "June",
                "July", "August", "September", "October", "November", "December"
              ];
          var date = new Date(milestone.period);
          return monthNames[date.getMonth()]
        case 'week':
          return 'Week#' + moment(milestone.period, 'yyyy-ww').week();
      }
    }
  },
{'fraction_non_alphanumeric': 0.15637530072173217, 'fraction_numerical': 0.0, 'mean_word_length': 2.8497942386831276, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4102056', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1160, 'n_words': 240}