Commit 7caf4de2cf1095bce65386d4c1bc7df604a09ae6

Authored by Riyad Preukschas
1 parent 6c1b4485

Fix setting Ace mode

Showing 1 changed file with 4 additions and 1 deletions   Show diff stats
app/views/tree/edit.html.haml
... ... @@ -19,8 +19,11 @@
19 19 = link_to "Cancel", project_tree_path(@project, @id), class: "btn cancel-btn", confirm: "Are you sure?"
20 20  
21 21 :javascript
  22 + var ace_mode = "#{@tree.language.try(:ace_mode)}";
22 23 var editor = ace.edit("editor");
23   - editor.getSession().setMode("ace/mode/javascript");
  24 + if (ace_mode) {
  25 + editor.getSession().setMode('ace/mode/' + ace_mode);
  26 + }
24 27  
25 28 $(".save-btn").click(function(){
26 29 $("#file_content").val(editor.getValue());
... ...