Sha256: 8d452309b1f3f7b1b47e59a15176a6ebdf29b49e0ea940f60c574503b8b1aeda

Contents?: true

Size: 808 Bytes

Versions: 10

Compression:

Stored size: 808 Bytes

Contents

var ace_edit = function(id, template_type, name) {
  if (!name) { name = 'template_content' }
  var editor_name = name + '_editor-' + id
  $('#'+editor_name).show();
  var editor = ace.edit(editor_name);
  var textarea = $('textarea[id="' + name + '-'+id+'"]').hide();
  var session = editor.getSession();
  session.setMode("ace/mode/" + template_type);
  session.setValue(textarea.val());
  session.setTabSize(2);
  session.setUseSoftTabs(true);
  session.setUseWrapMode(true);
  session.on('change', function(){
    textarea.val(editor.getSession().getValue());
  });
  editor.commands.addCommand({
    name: 'save',
    bindKey: {win: 'Ctrl-S',  mac: 'Command-S'},
    exec: function(editor) {
      $("#"+editor.container.id).closest('form').submit();
    },
    readOnly: false
  });
  return editor;
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
smithycms-0.5.1 app/assets/javascripts/smithy/templates.js
smithycms-0.5.0 app/assets/javascripts/smithy/templates.js
smithycms-0.4.5 app/assets/javascripts/smithy/templates.js
smithycms-0.4.4 app/assets/javascripts/smithy/templates.js
smithycms-0.4.3 app/assets/javascripts/smithy/templates.js
smithycms-0.4.2 app/assets/javascripts/smithy/templates.js
smithycms-0.4.1 app/assets/javascripts/smithy/templates.js
smithycms-0.4.0 app/assets/javascripts/smithy/templates.js
smithycms-0.0.3 app/assets/javascripts/smithy/templates.js
smithycms-0.0.1 app/assets/javascripts/smithy/templates.js