gitlab-org--gitlab-foss/app/assets/javascripts/blob/new_blob.js.coffee

22 lines
567 B
CoffeeScript
Raw Normal View History

2015-01-26 23:57:42 -05:00
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()
2015-01-27 01:39:48 -05:00
@editor = editor
2015-01-26 23:57:42 -05:00
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
2015-01-27 01:39:48 -05:00
editor: ->
return @editor