workflow_edit.html.twig 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. //lastDiv = $("#sonata-ba-field-container-{{ admin.uniqid }}_template").after();
  36. editor = $( ".ace_editor" );
  37. editor.parent("div").append($("#gojs").html());
  38. $("#gojs").remove();
  39. {% endif %}
  40. });
  41. </script>
  42. {% if admin.parameters.workflow_name is defined %}
  43. <div id="gojs" style="display:none">
  44. {% include 'WorkflowBundle:Workflow:show_workflow_graph_gojs.html.twig' with {'object': admin.parameters.workflow_subject, 'name': admin.parameters.workflow_name } %}
  45. <div>
  46. {% endif %}
  47. {% endblock %}