diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index 9a6d98c6d21970fd24408faf582a748b52422ff6..cf9e2a493811202bb386eb7d9d07bc143a442fc0 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -24,7 +24,7 @@ module Admin::ApplicationHelper link_to options.delete(:label) || t('delete'), polymorphic_url_param(object, **options), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: options.delete(:confirm_message) || t('please_confirm') }, class: button_classes_danger end diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index f9b54aa15a581f8474ec10f3701989cc0a4c832a..e89c183b907e367a5a25bf1dc494ebc4421d1f2d 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -61,7 +61,7 @@ class Communication::Website::Page < ApplicationRecord has_many :children, class_name: 'Communication::Website::Page', foreign_key: :parent_id, - dependent: :nullify + dependent: :destroy validates :title, presence: true diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 6cef3f3d82f4ea5f99cff223d9d990714f9a06a0..6f8ddcbb26013813c62769aa0fd76dab4e61d012 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -52,7 +52,7 @@ class Education::Program < ApplicationRecord has_many :children, class_name: 'Education::Program', foreign_key: :parent_id, - dependent: :nullify + dependent: :destroy has_and_belongs_to_many :schools, class_name: 'Education::School', join_table: 'education_programs_schools', @@ -95,6 +95,10 @@ class Education::Program < ApplicationRecord self.path = "#{parent&.path}/#{slug}".gsub(/\/+/, '/') end + def update_children_paths + children.each(&:save) + end + def list_of_other_programs university.list_of_programs.reject! { |p| p[:id] == id } end diff --git a/app/views/admin/administration/members/_list.html.erb b/app/views/admin/administration/members/_list.html.erb index f1cdd3ffb33e745505bfa1c5430bbbbde06d5f39..7a1dcab14161c160c26ccf1c0de3670e49b65c46 100644 --- a/app/views/admin/administration/members/_list.html.erb +++ b/app/views/admin/administration/members/_list.html.erb @@ -17,7 +17,7 @@ <%= link_to t('delete'), admin_administration_member_path(member), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger %> </div> </td> diff --git a/app/views/admin/communication/website/categories/_list.html.erb b/app/views/admin/communication/website/categories/_list.html.erb index af55dc0c97b4a5dc40501970d89356d37fe70685..25e053ef79540d24892f9c2bac35450cfc1b35ee 100644 --- a/app/views/admin/communication/website/categories/_list.html.erb +++ b/app/views/admin/communication/website/categories/_list.html.erb @@ -17,7 +17,7 @@ <%= link_to t('delete'), admin_communication_website_category_path(website_id: category.website.id, id: category.id), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger if can?(:destroy, category) %> </div> </td> diff --git a/app/views/admin/communication/website/menu/items/_treebranch.html.erb b/app/views/admin/communication/website/menu/items/_treebranch.html.erb index 2dbc404ee6065b7225defe42f6fc36dccc945fb8..841ea52d063e69c9f50bb1a52b8a39131efee7b8 100644 --- a/app/views/admin/communication/website/menu/items/_treebranch.html.erb +++ b/app/views/admin/communication/website/menu/items/_treebranch.html.erb @@ -22,7 +22,7 @@ <%= link_to t('delete'), admin_communication_website_menu_item_path(website_id: item.website.id, menu_id: item.menu.id, id: item.id), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger if can?(:destroy, item) %> </div> </div> diff --git a/app/views/admin/communication/website/menus/_list.html.erb b/app/views/admin/communication/website/menus/_list.html.erb index 139c6472abf20be83aac482da35a38995ba2bb0c..fa74e0adcaaa6ee23f39596c991f15b634cd81b6 100644 --- a/app/views/admin/communication/website/menus/_list.html.erb +++ b/app/views/admin/communication/website/menus/_list.html.erb @@ -17,7 +17,7 @@ <%= link_to t('delete'), admin_communication_website_menu_path(website_id: menu.website.id, id: menu.id), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger if can?(:destroy, menu) %> </div> </td> diff --git a/app/views/admin/communication/website/pages/_list.html.erb b/app/views/admin/communication/website/pages/_list.html.erb index f704df75504bfeff23a5a2a68ebdb3039c264bbf..54d0db98d0d1448d289561f013b1da2b5314c23d 100644 --- a/app/views/admin/communication/website/pages/_list.html.erb +++ b/app/views/admin/communication/website/pages/_list.html.erb @@ -21,7 +21,7 @@ <%= link_to t('delete'), admin_communication_website_page_path(website_id: page.website.id, id: page.id), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: page.children.any? ? t('please_confirm_with_children') : t('please_confirm') }, class: button_classes_danger if can?(:destroy, page) %> </div> </td> diff --git a/app/views/admin/communication/website/pages/_treebranch.html.erb b/app/views/admin/communication/website/pages/_treebranch.html.erb index e85e3fd3046d21020ff61374aaa58314a0cf0710..96980e5470c33def62a2ab6a658e6e7a16499664 100644 --- a/app/views/admin/communication/website/pages/_treebranch.html.erb +++ b/app/views/admin/communication/website/pages/_treebranch.html.erb @@ -18,7 +18,7 @@ <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> <div class="btn-group ms-auto" role="group"> <%= edit_link page %> - <%= destroy_link page %> + <%= destroy_link page, confirm_message: page.children.any? ? t('please_confirm_with_children') : t('please_confirm') %> </div> </div> <ul class="list-unstyled treeview__children js-treeview-children <%= 'js-treeview-sortable-container' if can?(:reorder, page) %> ms-4" data-id="<%= page.id %>"> diff --git a/app/views/admin/communication/website/posts/_list.html.erb b/app/views/admin/communication/website/posts/_list.html.erb index 210c0b54a1c8eef41f33be477b2e688927df1811..1fdddb507b588d2f5fc2824e9ff0924830c88531 100644 --- a/app/views/admin/communication/website/posts/_list.html.erb +++ b/app/views/admin/communication/website/posts/_list.html.erb @@ -45,7 +45,7 @@ <%= link_to t('delete'), admin_communication_website_post_path(website_id: post.website.id, id: post.id), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger if can?(:destroy, post) %> </div> </td> diff --git a/app/views/admin/education/programs/_list.html.erb b/app/views/admin/education/programs/_list.html.erb index 9dc1c1600f1060c7512bca4ddf07b5d415e1415e..9c084bf7120b7192fbbc39afca013f69a590c76d 100644 --- a/app/views/admin/education/programs/_list.html.erb +++ b/app/views/admin/education/programs/_list.html.erb @@ -15,9 +15,9 @@ edit_admin_education_program_path(program), class: button_classes %> <%= link_to t('delete'), - admin_research_journal_article_path(program), + admin_education_program_path(program), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: program.children.any? ? t('please_confirm_with_children') : t('please_confirm') }, class: button_classes_danger %> </div> </td> diff --git a/app/views/admin/education/programs/_treebranch.html.erb b/app/views/admin/education/programs/_treebranch.html.erb index 739e18caa1d23603bff3ac683ebb68d1521d2f2e..b70fff45869b86044d84869a447edd122a9cb763 100644 --- a/app/views/admin/education/programs/_treebranch.html.erb +++ b/app/views/admin/education/programs/_treebranch.html.erb @@ -17,7 +17,7 @@ <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> <div class="btn-group ms-auto" role="group"> <%= edit_link program %> - <%= destroy_link program %> + <%= destroy_link program, confirm_message: program.children.any? ? t('please_confirm_with_children') : t('please_confirm') %> </div> </div> <ul class="list-unstyled treeview__children js-treeview-children <%= 'js-treeview-sortable-container' if can?(:reorder, program) %> ms-4" data-id="<%= program.id %>"> diff --git a/app/views/admin/research/journal/articles/_list.html.erb b/app/views/admin/research/journal/articles/_list.html.erb index d5e338ea9354588dc8c48003fc30b49f1547a70d..806c59711ea40dfcf20f5d26dd7973b652984420 100644 --- a/app/views/admin/research/journal/articles/_list.html.erb +++ b/app/views/admin/research/journal/articles/_list.html.erb @@ -19,7 +19,7 @@ <%= link_to t('delete'), admin_research_journal_article_path(journal_id: article.journal, id: article), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger %> </div> </td> diff --git a/app/views/server/languages/index.html.erb b/app/views/server/languages/index.html.erb index 9f9d5506a2b3acb63e85e3a27de6c4114a552dd1..5a26dd08137ad674666e8e1eb9f4c808a118fdec 100644 --- a/app/views/server/languages/index.html.erb +++ b/app/views/server/languages/index.html.erb @@ -22,7 +22,7 @@ <%= link_to t('delete'), server_language_path(language), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger %> </div> </td> diff --git a/app/views/server/universities/index.html.erb b/app/views/server/universities/index.html.erb index 8f7a02c7e4b9cc0d777e942862f2443353295e19..75b999cfd6fa726bcdaac2ce53ce56a4245c2c33 100644 --- a/app/views/server/universities/index.html.erb +++ b/app/views/server/universities/index.html.erb @@ -23,7 +23,7 @@ <%= link_to t('delete'), server_university_path(university), method: :delete, - data: { confirm: t('please-confirm') }, + data: { confirm: t('please_confirm') }, class: button_classes_danger %> </div> </td> diff --git a/config/application.rb b/config/application.rb index 054ad27a60ad99fc6f39da449ff14853c8cb207d..4066c05a38912f51842cc8d19be02f1350dc5aa7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -59,11 +59,7 @@ module Osuny "name", "sizes", "src", "srcset", "style", "target", "title", "type", "width", "xml:lang" ] -<<<<<<< HEAD config.allowed_special_chars = '#?!,@$%^&*+:;£µ-' -======= - config.allowed_special_chars = '#?!,@$%^&*+£µ-:;' ->>>>>>> 180fe9d5da503643bf79111fb74f248d5bc32cea config.generators do |g| g.orm :active_record, primary_key_type: :uuid diff --git a/config/locales/en.yml b/config/locales/en.yml index 18ec715033922059c6e1546f7d902953901a992c..775168013c9dc7e5ad8d91abae9bf30b59051aa5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -103,7 +103,8 @@ en: server_admin: Admin server sign_out: Log out metadata: Metadata - please-confirm: Are you sure? + please_confirm: Are you sure? + please_confirm_with_children: "WARNING: deleting this element will also remove every child. Are you sure?" privacy_policy: Privacy policy privacy_policy_url: https://osuny.org/politique-de-confidentialite save: Save diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 0f603b7c6a343942ffd1ee5145cf563229286af5..571aaf22d96cf8cde34da2342dc758acdaacfe9e 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -103,7 +103,8 @@ fr: server_admin: Admin serveur sign_out: Déconnexion metadata: Informations - please-confirm: Est-ce que vous confirmez ? + please_confirm: Est-ce que vous confirmez ? + please_confirm_with_children: "ATTENTION : effacer cet élément supprimera aussi tous ses enfants. Est-ce que vous confirmez ?" privacy_policy: Politique de confidentialité privacy_policy_url: https://osuny.org/politique-de-confidentialite save: Enregistrer