<commit_before>Template.pastKlubEdit.helpers({
  pastKlub: function () {
    // this provides from url parameter
    return PastKlub.findOne({i: +this});
  },
  books: function () {
    return getAllBooks();
  }
});

Template.pastKlubEdit.events({
  'submit form': function (elt) {
    var _id = $('input.id').val(),
      klub = PastKlub.findOne(_id);

    elt.preventDefault();
    klub.i = +$("input.i").val();
    klub.klubMaster = $("input.klubMaster").val() || "anonymous";
    klub.date = $("input.date").val();
    klub.voteer = $("input.vote").val();
    klub.meetup = $("input.meetup").val();
    klub.book_id = $("select[name=selBook]").val();

    PastKlub.update(_id, klub);
  },
  'click .delete': function (elt) {
    var _id = $('input.id').val();

    elt.preventDefault();
    PastKlub.remove(_id);
    Router.go('adminPastKlubList');
  }
});

Template.pastKlubEdit.rendered = function () {
  /*
  Add this method because it works on refresh
  but won't by clicking on previous list page.
 */
  this.$("select[name='selBook']").val(this.$('input.book-id').val());
};<commit_msg>go to list after submitting<commit_after>Template.pastKlubEdit.helpers({
  pastKlub: function () {
    // this provides from url parameter
    return PastKlub.findOne({i: +this});
  },
  books: function () {
    return getAllBooks();
  }
});

Template.pastKlubEdit.events({
  'submit form': function (elt) {
    var _id = $('input.id').val(),
      klub = PastKlub.findOne(_id);

    elt.preventDefault();
    klub.i = +$("input.i").val();
    klub.klubMaster = $("input.klubMaster").val() || "anonymous";
    klub.date = $("input.date").val();
    klub.voteer = $("input.vote").val();
    klub.meetup = $("input.meetup").val();
    klub.book_id = $("select[name=selBook]").val();

    PastKlub.update(_id, klub);
    Router.go('adminPastKlubList');
  },
  'click .delete': function (elt) {
    var _id = $('input.id').val();

    elt.preventDefault();
    PastKlub.remove(_id);
    Router.go('adminPastKlubList');
  }
});

Template.pastKlubEdit.rendered = function () {
  /*
  Add this method because it works on refresh
  but won't by clicking on previous list page.
 */
  this.$("select[name='selBook']").val(this.$('input.book-id').val());
};
{'fraction_non_alphanumeric': 0.20428189116859946, 'fraction_numerical': 0.0, 'mean_word_length': 3.49498997995992, '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': '2550548', 'n_tokens_mistral': 813, 'n_tokens_neox': 780, 'n_words': 145}