Fix yml editing not setting values correctly

This commit is contained in:
2015-04-08 11:10:21 +02:00
parent e937070277
commit 7b333eec63
3 changed files with 5 additions and 2 deletions
@@ -14,9 +14,11 @@ class HtmlEdit
if template_field.length
editor.setValue template_field.val(), -1
editor.getSession().setMode 'ace/mode/haml'
console.log "Editing haml"
else
editor.setValue text_field.val(), -1
editor.getSession().setMode 'ace/mode/handlebars'
console.log "Editing handlebars"
editor.getSession().setTabSize(2)
editor.getSession().setUseSoftTabs(true)
editor.getSession().on 'change', (e)->
@@ -3,7 +3,7 @@ class YmlEdit
#ACE
$('.yml-content').each (i, el)->
text_field = $(el)
ace_div = $('<div></div>').addClass('ace-div').html(text_field.val())
ace_div = $('<div></div>').addClass('ace-div') #.html(text_field.val())
text_field.after ace_div
ace_div.css
width: '100%'
@@ -11,6 +11,7 @@ class YmlEdit
editor = ace.edit(ace_div.get(0))
editor.setTheme 'ace/theme/monokai'
editor.getSession().setMode 'ace/mode/yaml'
editor.getSession().setValue text_field.val()
editor.getSession().setTabSize(2)
editor.getSession().setUseSoftTabs(true)
editor.getSession().on 'change', (e)->
+1 -1
View File
@@ -9,7 +9,7 @@
tbody
- @yml_files.each do |yml_file|
tr
td= link_to yml_file.name, cmtool.yml_file_path(yml_file)
td= link_to yml_file.name, cmtool.edit_yml_file_path(yml_file)
= edit_td yml_file
= destroy_td yml_file
- else