From 6d454993cd82a8b84432badd9a0f2cfe340907d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Sun, 22 Dec 2019 14:39:45 +0100 Subject: [PATCH] #1064 Wrong sorting of Czech characters --- app/helpers/dmsf_helper.rb | 7 +++++++ app/views/dmsf/_dir.html.erb | 2 +- app/views/dmsf/_dir_trash.html.erb | 2 +- app/views/dmsf/_file.html.erb | 2 +- app/views/dmsf/_file_trash.html.erb | 2 +- app/views/dmsf/_url.html.erb | 2 +- app/views/dmsf/_url_trash.html.erb | 2 +- 7 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/helpers/dmsf_helper.rb b/app/helpers/dmsf_helper.rb index a9ce0b1e..4648c9ea 100644 --- a/app/helpers/dmsf_helper.rb +++ b/app/helpers/dmsf_helper.rb @@ -191,4 +191,11 @@ module DmsfHelper principals_check_box_tags 'user_ids[]', users end + # Replace specifics characters with their ASCII version + 'z' in order to fix the wrong ordering + # e.g. 'č' -> 'cz' + def clear_title(title) + title.gsub!(/[ěščřýáíéůúďťňĚŠČŘÝÁÍÉÚŮĎŤŇ]/) { |c| c + 'z' } + title.tr('ěščřýáíéůúďťňĚŠČŘÝÁÍÉÚŮĎŤŇ', 'escryaieuudtnESCRYAIEUUDTN') + end + end diff --git a/app/views/dmsf/_dir.html.erb b/app/views/dmsf/_dir.html.erb index c943fd7b..2fc0464c 100644 --- a/app/views/dmsf/_dir.html.erb +++ b/app/views/dmsf/_dir.html.erb @@ -128,4 +128,4 @@ 0 <%= subfolder.modified.to_i if subfolder %> 0 -<%= title %> +<%= clear_title(title) %> diff --git a/app/views/dmsf/_dir_trash.html.erb b/app/views/dmsf/_dir_trash.html.erb index 5988a470..8ee438f1 100644 --- a/app/views/dmsf/_dir_trash.html.erb +++ b/app/views/dmsf/_dir_trash.html.erb @@ -87,4 +87,4 @@ 0 <%= subfolder.modified.to_i if subfolder %> 0 -<%= title %> +<%= clear_title(title) %> diff --git a/app/views/dmsf/_file.html.erb b/app/views/dmsf/_file.html.erb index 831d7cce..34663c41 100644 --- a/app/views/dmsf/_file.html.erb +++ b/app/views/dmsf/_file.html.erb @@ -139,4 +139,4 @@ <%= file.last_revision.size %> <%= file.last_revision.updated_at.to_i %> <%= file.last_revision.iversion %> -<%= title %> +<%= clear_title(title) %> diff --git a/app/views/dmsf/_file_trash.html.erb b/app/views/dmsf/_file_trash.html.erb index 47484704..0939786e 100644 --- a/app/views/dmsf/_file_trash.html.erb +++ b/app/views/dmsf/_file_trash.html.erb @@ -81,4 +81,4 @@ <%= file.last_revision.size %> <%= file.last_revision.updated_at.to_i %> <%= file.last_revision.iversion %> -<%= title %> +<%= clear_title(title) %> diff --git a/app/views/dmsf/_url.html.erb b/app/views/dmsf/_url.html.erb index 263b15b8..5cc565dd 100644 --- a/app/views/dmsf/_url.html.erb +++ b/app/views/dmsf/_url.html.erb @@ -85,4 +85,4 @@ link.updated_at.to_i -<%= title %> +<%= clear_title(title) %> diff --git a/app/views/dmsf/_url_trash.html.erb b/app/views/dmsf/_url_trash.html.erb index 0cace384..487b0f88 100644 --- a/app/views/dmsf/_url_trash.html.erb +++ b/app/views/dmsf/_url_trash.html.erb @@ -75,4 +75,4 @@ <%= link.updated_at.to_i %> -<%= title %> +<%= clear_title(title) %>