You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
658 B

  1. if($('#page-type-create').length) {
  2. //-> Discard
  3. $('.btn-create-discard').on('click', (ev) => {
  4. $('#modal-create-discard').toggleClass('is-active');
  5. });
  6. //-> Save
  7. $('.btn-create-save').on('click', (ev) => {
  8. $.ajax(window.location.href, {
  9. data: {
  10. markdown: mde.value()
  11. },
  12. dataType: 'json',
  13. method: 'PUT'
  14. }).then((rData, rStatus, rXHR) => {
  15. if(rData.ok) {
  16. window.location.assign('/' + $('#page-type-create').data('entrypath'));
  17. } else {
  18. alerts.pushError('Something went wrong', rData.error);
  19. }
  20. }, (rXHR, rStatus, err) => {
  21. alerts.pushError('Something went wrong', 'Save operation failed.');
  22. });
  23. });
  24. }