diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2024-12-11 19:08:27 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2024-12-11 19:08:27 +0000 |
commit | c065e4374ad561f69bf93b78d31b395bee848ca1 (patch) | |
tree | 54c7ea9ea07d630c27c97f6ea91f9c48adba8d96 | |
parent | dbd6bb4073ebfe54b494203eb55944a0f300ea3d (diff) | |
download | redmine-c065e4374ad561f69bf93b78d31b395bee848ca1.tar.gz redmine-c065e4374ad561f69bf93b78d31b395bee848ca1.zip |
Adds global setting In Display tab to disable JS based table sort in wiki content (#40588).
Patch by Jens Krämer (user:jkraemer).
git-svn-id: https://svn.redmine.org/redmine/trunk@23401 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/assets/javascripts/application.js | 1 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 10 | ||||
-rw-r--r-- | app/views/settings/_display.html.erb | 2 | ||||
-rw-r--r-- | config/locales/de.yml | 1 | ||||
-rw-r--r-- | config/locales/en.yml | 1 | ||||
-rw-r--r-- | config/settings.yml | 2 |
6 files changed, 12 insertions, 5 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 5b2578b7a..935aef4a9 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1130,6 +1130,7 @@ function setupAttachmentDetail() { } function setupWikiTableSortableHeader() { + if (typeof Tablesort === 'undefined') { return; } $('div.wiki table').each(function(i, table){ if (table.rows.length < 3) return true; var tr = $(table.rows).first(); diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2db6ce7ee..fe250f7f3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1790,12 +1790,12 @@ module ApplicationHelper tags = javascript_include_tag( 'jquery-3.7.1-ui-1.13.3', 'rails-ujs', - 'tribute-5.1.3.min', - 'tablesort-5.2.1.min.js', - 'tablesort-5.2.1.number.min.js', - 'application', - 'responsive' + 'tribute-5.1.3.min' ) + if Setting.wiki_tablesort_enabled? + tags << javascript_include_tag('tablesort-5.2.1.min.js', 'tablesort-5.2.1.number.min.js') + end + tags << javascript_include_tag('application', 'responsive') unless User.current.pref.warn_on_leaving_unsaved == '0' warn_text = escape_javascript(l(:text_warn_on_leaving_unsaved)) tags << diff --git a/app/views/settings/_display.html.erb b/app/views/settings/_display.html.erb index 30e6525f7..62c53dfbb 100644 --- a/app/views/settings/_display.html.erb +++ b/app/views/settings/_display.html.erb @@ -29,6 +29,8 @@ <p><%= setting_text_field :thumbnails_size, :size => 6 %></p> <p><%= setting_select :new_item_menu_tab, [[l(:label_none), '0'], [l(:label_new_project_issue_tab_enabled), '1'], [l(:label_new_object_tab_enabled), '2']] %></p> + +<p><%= setting_check_box :wiki_tablesort_enabled %></p> </div> <%= submit_tag l(:button_save) %> diff --git a/config/locales/de.yml b/config/locales/de.yml index 527afa2d1..4947ead29 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1462,3 +1462,4 @@ de: zero: "%{filename}" one: "%{filename} and 1 file" other: "%{filename} and %{count} files" + setting_wiki_tablesort_enabled: Javascript-basierte Tabellensortierung in Wiki-Inhalten diff --git a/config/locales/en.yml b/config/locales/en.yml index 9ac73ff44..aa15095c6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1424,3 +1424,4 @@ en: text_user_destroy_confirmation: "Are you sure you want to delete this user and remove all references to them? This cannot be undone. Often, locking a user instead of deleting them is the better solution. To confirm, please enter their login (%{login}) below." text_project_destroy_enter_identifier: "To confirm, please enter the project's identifier (%{identifier}) below." field_name_or_email_or_login: Name, email or login + setting_wiki_tablesort_enabled: Javascript based table sorting in wiki content diff --git a/config/settings.yml b/config/settings.yml index 19d3a33c7..48da91a10 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -349,3 +349,5 @@ timelog_accept_future_dates: default: 1 show_status_changes_in_mail_subject: default: 1 +wiki_tablesort_enabled: + default: 1 |