workflow_edit.html.twig 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. {% extends 'SonataAdminBundle:CRUD:base_edit.html.twig' %}
  2. {% block parentForm %}
  3. <div class="alert alert-info">
  4. {{ 'workflow_edit_create_alert'|trans({}, 'WorkflowBundle') }} <br />
  5. - {{ 'Workflow Documentation'|trans({}, 'WorkflowBundle') }} <a target="_blank" href="http://symfony.com/blog/new-in-symfony-3-2-workflow-component">http://symfony.com/blog/new-in-symfony-3-2-workflow-component</a><br />
  6. - {{ 'YAML Documentation'|trans({}, 'WorkflowBundle') }} <a target="_blank" href="http://docs.ansible.com/ansible/YAMLSyntax.html">http://docs.ansible.com/ansible/YAMLSyntax.html</a>
  7. </div>
  8. {{ parent() }}
  9. {#https://github.com/ryanburnette/textarea-as-ace-editor#}
  10. {#https://ace.c9.io/#}
  11. {#https://ace.c9.io/build/kitchen-sink.html#}
  12. <script src="{{ asset('bundles/baseadmin') }}/ace_editor/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
  13. <script src="{{ asset('bundles/baseadmin') }}/ace_editor/textarea-as-ace-editor.js" type="text/javascript" charset="utf-8"></script>
  14. <style type="text/css" media="screen">
  15. .ace_editor {
  16. height: 250px!important;
  17. }
  18. .form-actions.stuck {
  19. z-index: 99999!important;
  20. }
  21. </style>
  22. <script type="text/javascript">
  23. $( document ).ready(function() {
  24. $("textarea").asAceEditor();
  25. editor = $('textarea').data('ace-editor');
  26. editor.setTheme("ace/theme/github");
  27. editor.getSession().setMode("ace/mode/yaml");
  28. //editor.setReadOnly(true);
  29. editor.setFontSize(14);
  30. editor.setShowInvisibles(true);
  31. editor.getSession().setTabSize(2);
  32. editor.getSession().setUseSoftTabs(true);
  33. editor.getSession().setUseWrapMode(true);
  34. {% if admin.parameters.workflow_name is defined %}
  35. editor = $( ".ace_editor" );
  36. image = "{{ app.request.schemeAndHttpHost ~ app.request.baseUrl }}/../workflows_png/{{admin.parameters.workflow_name}}.png?nocache={{ date().timestamp }}";
  37. editor.parent("div").append("<div> <br /> <img src='"+ image +"'</div>");
  38. {% endif %}
  39. });
  40. </script>
  41. {% endblock %}