##// END OF EJS Templates
scm: remove trailing white-spaces from repositories controller....
Toshi MARUYAMA -
r5754:782f7ca3bf2b
parent child
Show More
@@ -1,16 +1,16
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -154,7 +154,7 class RepositoriesController < ApplicationController
154
154
155 def is_entry_text_data?(ent, path)
155 def is_entry_text_data?(ent, path)
156 # UTF-16 contains "\x00".
156 # UTF-16 contains "\x00".
157 # It is very strict that file contains less than 30% of ascii symbols
157 # It is very strict that file contains less than 30% of ascii symbols
158 # in non Western Europe.
158 # in non Western Europe.
159 return true if Redmine::MimeType.is_type?('text', path)
159 return true if Redmine::MimeType.is_type?('text', path)
160 # Ruby 1.8.6 has a bug of integer divisions.
160 # Ruby 1.8.6 has a bug of integer divisions.
@@ -198,7 +198,7 class RepositoriesController < ApplicationController
198 else
198 else
199 @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
199 @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
200 @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
200 @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
201
201
202 # Save diff type as user preference
202 # Save diff type as user preference
203 if User.current.logged? && @diff_type != User.current.pref[:diff_type]
203 if User.current.logged? && @diff_type != User.current.pref[:diff_type]
204 User.current.pref[:diff_type] = @diff_type
204 User.current.pref[:diff_type] = @diff_type
@@ -308,7 +308,7 class RepositoriesController < ApplicationController
308 :data => changes_by_month[0..11].reverse,
308 :data => changes_by_month[0..11].reverse,
309 :title => l(:label_change_plural)
309 :title => l(:label_change_plural)
310 )
310 )
311
311
312 graph.burn
312 graph.burn
313 end
313 end
314
314
@@ -318,18 +318,18 class RepositoriesController < ApplicationController
318
318
319 changes_by_author = repository.changes.count(:all, :group => :committer)
319 changes_by_author = repository.changes.count(:all, :group => :committer)
320 h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
320 h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
321
321
322 fields = commits_by_author.collect {|r| r.first}
322 fields = commits_by_author.collect {|r| r.first}
323 commits_data = commits_by_author.collect {|r| r.last}
323 commits_data = commits_by_author.collect {|r| r.last}
324 changes_data = commits_by_author.collect {|r| h[r.first] || 0}
324 changes_data = commits_by_author.collect {|r| h[r.first] || 0}
325
325
326 fields = fields + [""]*(10 - fields.length) if fields.length<10
326 fields = fields + [""]*(10 - fields.length) if fields.length<10
327 commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
327 commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
328 changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10
328 changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10
329
329
330 # Remove email adress in usernames
330 # Remove email adress in usernames
331 fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
331 fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
332
332
333 graph = SVG::Graph::BarHorizontal.new(
333 graph = SVG::Graph::BarHorizontal.new(
334 :height => 400,
334 :height => 400,
335 :width => 800,
335 :width => 800,
General Comments 0
You need to be logged in to leave comments. Login now