<commit_before>$ ->
    app = new SurveyApp({})
    $("#builder").html(app.render().$el)

    saveButton = $("<button>", id: "save", text: "Save", class: "btn btn-default")
    downloadPreviewButton = $("<button>", id: "preview", text: "Download Preview", class: "btn btn-default")

    buttonWrap = app.$el.find(".buttons")
    downloadPreviewButton.appendTo(buttonWrap)
    saveButton.appendTo(buttonWrap)<commit_msg>added basic download and save buttons<commit_after>$ ->
  app = new SurveyApp({})
  $("#builder").html(app.render().$el)

  saveButton = $("<button>", id: "save", text: "Save", class: "btn btn-default")
  downloadPreviewButton = $("<button>", id: "preview", text: "Download Preview", class: "btn btn-default")

  saveButton.click ->
    if app.validateSurvey()
      csv_txt = app.survey.toCSV()

  downloadPreviewButton.click ->
    if app.validateSurvey()
      csv_text = app.survey.toCSV()
      $.post("/xform_preview", {csv_txt: csv_text}).done (r)->
        log "Download this XForm", r

  buttonWrap = app.$el.find(".buttons")
  downloadPreviewButton.appendTo(buttonWrap)
  saveButton.appendTo(buttonWrap)
{'fraction_non_alphanumeric': 0.18109540636042404, 'fraction_numerical': 0.0, 'mean_word_length': 4.269767441860465, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1879168', 'n_tokens_mistral': 363, 'n_tokens_neox': 352, 'n_words': 79}