<commit_before>Template.bookEdit.helpers({
  book: function () {
    // this provided from url parameter
    return Books.findOne(this.toString());
  }
});

Template.bookEdit.events({
  'submit form': function (elt) {
    var _id = $('input.id').val(),
      book = _id ? Books.findOne(_id) : {};

    elt.preventDefault();
    book.author = $("input.author").val();
    book.title = $("input.title").val();
    book.img = $("input.img").val();
    book.site = $("input.site").val();
    book.origin = $("input.origin").val();
    book.teaser = $("input.teaser").val();
    book.statut = $("input.statut").val();
    Books.update(_id, book);
    Router.go('adminBookList');
  },
  'click .freeze': function (elt) {
    var _id = $('input.id').val(),
      book = _id ? Books.findOne(_id) : {};

    elt.preventDefault();
    book.author = $("input.author").val();
    book.title = $("input.title").val();
    book.statut = "frozen";
    Books.update(_id, book);
    Router.go('adminBookList');
  },
  'click .delete': function (elt) {<commit_msg>refactor edit book by admin (w/o create)<commit_after>Template.bookEdit.helpers({
  book: function () {
    // this provided from url parameter
    return Books.findOne(this.toString());
  }
});

Template.bookEdit.events({
  'submit form': function (elt) {
    var _id = $('input.id').val(),
      book = Books.findOne(_id);

    elt.preventDefault();
    book.author = $("input.author").val();
    book.title = $("input.title").val();
    book.img = $("input.img").val();
    book.site = $("input.site").val();
    book.origin = $("input.origin").val();
    book.teaser = $("input.teaser").val();
    book.statut = $("input.statut").val();
    Books.update(_id, book);
    Router.go('adminBookList');
  },
  'click .freeze': function (elt) {
    var _id = $('input.id').val(),
      book = Books.findOne(_id);

    elt.preventDefault();
    book.statut = "frozen";
    Books.update(_id, book);
    Router.go('adminBookList');
  },
  'click .delete': function (elt) {
{'fraction_non_alphanumeric': 0.21907600596125187, 'fraction_numerical': 0.0, 'mean_word_length': 3.1784232365145226, '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': '6524231', 'n_tokens_mistral': 690, 'n_tokens_neox': 678, 'n_words': 126}