]> source.dussan.org Git - redmine.git/commitdiff
scm: attachment: remove "to_utf8" methods from helpers (#2371)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 20 Nov 2011 12:04:11 +0000 (12:04 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 20 Nov 2011 12:04:11 +0000 (12:04 +0000)
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
app/helpers/repositories_helper.rb
app/views/common/_diff.html.erb
app/views/common/_file.html.erb
app/views/repositories/annotate.html.erb

index 3d98b95d3094fcd1ce3f714793bc55146379401c..bc07cff54f8095675e6057c11864e78590d2753d 100644 (file)
@@ -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
index de017ef9b8d6d1d9dbd94718756f965debaf02a0..b9b797b8fa62f659bd7661e9c57a50d41639bec5 100644 (file)
@@ -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) &&
index 1f3f82540cdcbdebec6d1156207942147ead0950..3e03720f82059adf58361802bcb39fac8c0cf0cc 100644 (file)
@@ -7,7 +7,11 @@
 <% if diff.diff_type == 'sbs' -%>
 <table class="filecontent">
 <thead>
-<tr><th colspan="4" class="filename"><%=h(to_utf8(table_file.file_name)) %></th></tr>
+<tr>
+  <th colspan="4" class="filename">
+    <%= h(Redmine::CodesetUtil.to_utf8_by_setting(table_file.file_name)) %>
+  </th>
+</tr>
 </thead>
 <tbody>
 <% table_file.each_line do |spacing, line| -%>
 <tr>
   <th class="line-num"><%= line.nb_line_left %></th>
   <td class="line-code <%= line.type_diff_left %>">
-    <pre><%=to_utf8 line.html_line_left %></pre>
+    <pre><%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line_left) %></pre>
   </td>
   <th class="line-num"><%= line.nb_line_right %></th>
   <td class="line-code <%= line.type_diff_right %>">
-    <pre><%=to_utf8 line.html_line_right %></pre>
+    <pre><%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line_right) %></pre>
   </td>
 </tr>
 <% end -%>
 <% else -%>
 <table class="filecontent">
 <thead>
-<tr><th colspan="3" class="filename"><%=h(to_utf8(table_file.file_name)) %></th></tr>
+  <tr>
+    <th colspan="3" class="filename">
+      <%= h(Redmine::CodesetUtil.to_utf8_by_setting(table_file.file_name)) %>
+    </th>
+  </tr>
 </thead>
 <tbody>
 <% table_file.each_line do |spacing, line| %>
@@ -46,7 +54,7 @@
   <th class="line-num"><%= line.nb_line_left %></th>
   <th class="line-num"><%= line.nb_line_right %></th>
   <td class="line-code <%= line.type_diff %>">
-    <pre><%=to_utf8 line.html_line %></pre>
+    <pre><%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line) %></pre>
   </td>
 </tr>
 <% end -%>
index db00c0617b7c9bca86835dae969d2e25e19e7ad2..418073efae2388e50d4b851c7fb7e4acf034fff1 100644 (file)
@@ -2,7 +2,7 @@
 <table class="filecontent syntaxhl">
 <tbody>
 <% 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| %>
   <tr>
     <th class="line-num" id="L<%= line_num %>">
       <a href="#L<%= line_num %>"><%= line_num %></a>
index a9fe85f12c14c67f79cc3ff24126e338ee2a1ad3..444ae2a3aeafc1d471bae62444759e94c3d7507d 100644 (file)
@@ -14,7 +14,7 @@
 <table class="filecontent annotate syntaxhl">
   <tbody>
     <% 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] %>
       <tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
         <th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th>