From fb75372b86c59b858c7ad60040325ab117495775 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 20 Nov 2011 12:04:11 +0000 Subject: [PATCH] scm: attachment: remove "to_utf8" methods from helpers (#2371) It is confusing that same name methods are in several helpers. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7871 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/attachments_helper.rb | 4 ---- app/helpers/repositories_helper.rb | 4 ---- app/views/common/_diff.html.erb | 18 +++++++++++++----- app/views/common/_file.html.erb | 2 +- app/views/repositories/annotate.html.erb | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index 3d98b95d3..bc07cff54 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -28,10 +28,6 @@ module AttachmentsHelper end end - def to_utf8(str) - Redmine::CodesetUtil.to_utf8_by_setting(str) - end - def render_api_attachment(attachment, api) api.attachment do api.id attachment.id diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index de017ef9b..b9b797b8f 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -116,10 +116,6 @@ module RepositoriesHelper output.html_safe end - def to_utf8(str) - Redmine::CodesetUtil.to_utf8_by_setting(str) - end - def repository_field_tags(form, repository) method = repository.class.name.demodulize.underscore + "_field_tags" if repository.is_a?(Repository) && diff --git a/app/views/common/_diff.html.erb b/app/views/common/_diff.html.erb index 1f3f82540..3e03720f8 100644 --- a/app/views/common/_diff.html.erb +++ b/app/views/common/_diff.html.erb @@ -7,7 +7,11 @@ <% if diff.diff_type == 'sbs' -%> - + + + <% table_file.each_line do |spacing, line| -%> @@ -19,11 +23,11 @@ <% end -%> @@ -33,7 +37,11 @@ <% else -%>
<%=h(to_utf8(table_file.file_name)) %>
+ <%= h(Redmine::CodesetUtil.to_utf8_by_setting(table_file.file_name)) %> +
<%= line.nb_line_left %> -
<%=to_utf8 line.html_line_left %>
+
<%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line_left) %>
<%= line.nb_line_right %> -
<%=to_utf8 line.html_line_right %>
+
<%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line_right) %>
- + + + <% table_file.each_line do |spacing, line| %> @@ -46,7 +54,7 @@ <% end -%> diff --git a/app/views/common/_file.html.erb b/app/views/common/_file.html.erb index db00c0617..418073efa 100644 --- a/app/views/common/_file.html.erb +++ b/app/views/common/_file.html.erb @@ -2,7 +2,7 @@
<%=h(to_utf8(table_file.file_name)) %>
+ <%= h(Redmine::CodesetUtil.to_utf8_by_setting(table_file.file_name)) %> +
<%= line.nb_line_left %> <%= line.nb_line_right %> -
<%=to_utf8 line.html_line %>
+
<%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line) %>
<% line_num = 1 %> -<% syntax_highlight(filename, to_utf8(content)).each_line do |line| %> +<% syntax_highlight(filename, Redmine::CodesetUtil.to_utf8_by_setting(content)).each_line do |line| %>
<%= line_num %> diff --git a/app/views/repositories/annotate.html.erb b/app/views/repositories/annotate.html.erb index a9fe85f12..444ae2a3a 100644 --- a/app/views/repositories/annotate.html.erb +++ b/app/views/repositories/annotate.html.erb @@ -14,7 +14,7 @@ <% line_num = 1 %> - <% syntax_highlight(@path, to_utf8(@annotate.content)).each_line do |line| %> + <% syntax_highlight(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each_line do |line| %> <% revision = @annotate.revisions[line_num - 1] %> -- 2.39.5
<%= line_num %>