Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

87 lines
2.7KB

  1. window.addEventListener('load', (event) => {
  2. SovNotification.init();
  3. SovWidgets.setDateRange();
  4. $('.btn-confirm-js, .action-confirm').click(function () {
  5. return confirm('Êtes-vous sûr de vouloir réaliser cette action ?');
  6. });
  7. /* Tooltip */
  8. $('[data-toggle="tooltip"]').tooltip();
  9. /* Select2 */
  10. if ($('.form-select, .select2, select.form-control').length) {
  11. $('form .form-widget>select.form-control, .select2, .form-select').each(function (i, elm) {
  12. if (!$(this).hasClass('disable-select2')) {
  13. SovWidgets.setSelect2($(elm));
  14. }
  15. });
  16. $('form select.form-control').each(function (i, elm) {
  17. if (!$(this).hasClass('disable-select2')) {
  18. SovWidgets.setSelect2($(elm));
  19. }
  20. });
  21. }
  22. $('.action-delete').on('click', function (e) {
  23. e.preventDefault();
  24. const formAction = $(this).attr('formaction');
  25. $('#modal-delete').modal({backdrop: true, keyboard: true})
  26. .off('click', '#modal-delete-button')
  27. .on('click', '#modal-delete-button', function () {
  28. let deleteForm = $('#delete-form');
  29. deleteForm.attr('action', formAction);
  30. deleteForm.submit();
  31. });
  32. });
  33. var elements = $('.lc-ckeditor');
  34. if (elements.length) {
  35. for (var i = 0; i < elements.length; ++i) {
  36. if ($(elements[i]).data('config') === 'simple_config') {
  37. CKEDITOR.replace(elements[i], {
  38. "toolbar": [
  39. {
  40. items: ['Bold', 'Italic', 'Underline', 'Strike']
  41. },
  42. {
  43. items: ["TextColor"]
  44. }
  45. ],
  46. "language": "fr",
  47. 'height': 100
  48. });
  49. } else {
  50. CKEDITOR.replace(elements[i], {
  51. "toolbar": [
  52. {
  53. name: "styles",
  54. items: ["Format", 'Bold', 'Italic', 'Underline', 'Strike', "Link", "BulletedList"]
  55. },
  56. {
  57. items: ["TextColor"]
  58. },
  59. {name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']},
  60. {name: 'insert', items: ['Image', 'SpecialChar']},
  61. {name: "document", items: ["Source"]},
  62. ],
  63. "language": "fr"
  64. });
  65. }
  66. }
  67. }
  68. SovWidgets.setAutoCompleteField();
  69. });