Fix setting Ace mode

This commit is contained in:
Riyad Preukschas 2012-11-17 15:28:32 +01:00
parent 6c1b44859d
commit 7caf4de2cf

View file

@ -19,8 +19,11 @@
= link_to "Cancel", project_tree_path(@project, @id), class: "btn cancel-btn", confirm: "Are you sure?"
:javascript
var ace_mode = "#{@tree.language.try(:ace_mode)}";
var editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/javascript");
if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode);
}
$(".save-btn").click(function(){
$("#file_content").val(editor.getValue());