src/Cms/ModuleBundle/Resources/views/Content/includes/editor/actions/Publish.html.twig line 1

Open in your IDE?
  1. <div id="btnwrap{{ key }}" class="editor__btn-wrap">
  2.     {% include '@ui/common/buttons/split.html.twig' with {
  3.         primary: {
  4.             text: actionForm.label,
  5.             htmlClass: 'btn-publish',
  6.             size: 'lg',
  7.             helper: 'primary',
  8.             htmlId: 'btn' ~ key ~ 'Immediate'
  9.         },
  10.         secondary: {
  11.             sronly: true,
  12.             text: actionForm.label,
  13.             icon: 'clock-o',
  14.             htmlClass: 'btn-schedule',
  15.             size: 'lg',
  16.             helper: 'primary',
  17.             htmlId: 'btn' ~ key ~ 'Schedule',
  18.             helpText: 'Schedule a later publish date.',
  19.         }
  20.     } %}
  21. </div>
  22. {% set buttons %}
  23.     <p>
  24.         {% include '@ui/common/buttons/forms/submit.html.twig' with {
  25.             text: 'Schedule',
  26.             helper: actionForm.helper|default('success'),
  27.             size: 'lg',
  28.             block: true
  29.         } %}
  30.     </p>
  31. {% endset %}
  32. {% include '@CmsModule/Content/includes/editor/action_modal.html.twig' with {
  33.     action: key,
  34.     icon: actionForm.icon|default(null),
  35.     heading: actionForm.title|default(actionForm.label),
  36.     lead: actionForm.header,
  37.     form: actionForm.form,
  38.     footer: actionForm.footer,
  39.     buttons: buttons
  40. } %}
  41. {% inline_script %}
  42.     <script>
  43.         editorActionHandler('{{ key }}', function (e) {
  44.             var $modal = $('#modal{{ key }}'),
  45.                 $frm = $('#frm{{ key }}'),
  46.                 $target = $(e.currentTarget);
  47.             switch ($target.attr('id')) {
  48.                 case 'btn{{ key }}Schedule':
  49.                     $('#{{ actionForm.form['publishAt'].vars.id }}').attr('required', true);
  50.                     $modal.modal({});
  51.                     break;
  52.                 case 'btn{{ key }}Immediate':
  53.                     $('#{{ actionForm.form['publishAt'].vars.id }}').attr('required', false);
  54.                     $frm.submit();
  55.                     break;
  56.             }
  57.             e.preventDefault();
  58.         });
  59.     </script>
  60. {% endinline %}