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
This commit is contained in:
Marius Balteanu
2024-12-11 19:08:27 +00:00
parent dbd6bb4073
commit c065e4374a
6 changed files with 12 additions and 5 deletions

View File

@@ -1130,6 +1130,7 @@ function setupAttachmentDetail() {
} }
function setupWikiTableSortableHeader() { function setupWikiTableSortableHeader() {
if (typeof Tablesort === 'undefined') { return; }
$('div.wiki table').each(function(i, table){ $('div.wiki table').each(function(i, table){
if (table.rows.length < 3) return true; if (table.rows.length < 3) return true;
var tr = $(table.rows).first(); var tr = $(table.rows).first();

View File

@@ -1790,12 +1790,12 @@ module ApplicationHelper
tags = javascript_include_tag( tags = javascript_include_tag(
'jquery-3.7.1-ui-1.13.3', 'jquery-3.7.1-ui-1.13.3',
'rails-ujs', 'rails-ujs',
'tribute-5.1.3.min', 'tribute-5.1.3.min'
'tablesort-5.2.1.min.js',
'tablesort-5.2.1.number.min.js',
'application',
'responsive'
) )
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' unless User.current.pref.warn_on_leaving_unsaved == '0'
warn_text = escape_javascript(l(:text_warn_on_leaving_unsaved)) warn_text = escape_javascript(l(:text_warn_on_leaving_unsaved))
tags << tags <<

View File

@@ -29,6 +29,8 @@
<p><%= setting_text_field :thumbnails_size, :size => 6 %></p> <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_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> </div>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>

View File

@@ -1462,3 +1462,4 @@ de:
zero: "%{filename}" zero: "%{filename}"
one: "%{filename} and 1 file" one: "%{filename} and 1 file"
other: "%{filename} and %{count} files" other: "%{filename} and %{count} files"
setting_wiki_tablesort_enabled: Javascript-basierte Tabellensortierung in Wiki-Inhalten

View File

@@ -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_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." 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 field_name_or_email_or_login: Name, email or login
setting_wiki_tablesort_enabled: Javascript based table sorting in wiki content

View File

@@ -349,3 +349,5 @@ timelog_accept_future_dates:
default: 1 default: 1
show_status_changes_in_mail_subject: show_status_changes_in_mail_subject:
default: 1 default: 1
wiki_tablesort_enabled:
default: 1