summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/blob/new_blob.js.coffee
blob: ed4b7c47936c9099e4f7263dc38435d02e7e6253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class @NewBlob
  constructor: (assets_path, mode)->
    ace.config.set "modePath", assets_path + '/ace'
    ace.config.loadModule "ace/ext/searchbox"
    if mode
      ace_mode = mode
    editor = ace.edit("editor")
    editor.focus()

    if ace_mode
      editor.getSession().setMode "ace/mode/" + ace_mode

    disableButtonIfEmptyField "#commit_message", ".js-commit-button"
    $(".js-commit-button").click ->
      $("#file-content").val editor.getValue()
      $(".file-editor form").submit()
      return