summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValeriy Sizov <vsv2711@gmail.com>2012-06-24 01:14:45 +0300
committerValeriy Sizov <vsv2711@gmail.com>2012-06-24 01:14:45 +0300
commit1e1c5b7afe42d6d88997aaa4f4877c37965866a5 (patch)
tree28c3ab938910f19d61aabcfcf8cfe83a27f6300b
parent279c4262f92173ef6d35816db521028a3bdb7f17 (diff)
downloadgitlab-ce-1e1c5b7afe42d6d88997aaa4f4877c37965866a5.tar.gz
Diff refactoring
-rw-r--r--app/helpers/commits_helper.rb10
-rw-r--r--app/views/commits/_text_file.html.haml2
2 files changed, 6 insertions, 6 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index a314f3876bd..7ee85a5b487 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -17,7 +17,7 @@ module CommitsHelper
preserve out
end
- def diff_line_class(line)
+ def identification_type(line)
if line[0] == "+"
"new"
elsif line[0] == "-"
@@ -27,7 +27,7 @@ module CommitsHelper
end
end
- def build_line_code(line, index, line_new, line_old)
+ def build_line_anchor(index, line_new, line_old)
"#{index}_#{line_old}_#{line_new}"
end
@@ -51,12 +51,12 @@ module CommitsHelper
line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
- next if line_old == 1 && line_new == 1
+ next if line_old == 1 && line_new == 1 #top of file
yield(full_line, type, nil, nil, nil)
next
else
- type = diff_line_class(line)
- line_code = build_line_code(line, index, line_new, line_old)
+ type = identification_type(line)
+ line_code = build_line_anchor(index, line_new, line_old)
yield(full_line, type, line_code, line_new, line_old)
end
diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_file.html.haml
index fa3d83ca85d..cab066410b4 100644
--- a/app/views/commits/_text_file.html.haml
+++ b/app/views/commits/_text_file.html.haml
@@ -1,4 +1,4 @@
-- too_big = max_lines = diff.diff.lines.count > 1000
+- too_big = diff.diff.lines.count > 1000
- if too_big
%a.supp_diff_link Diff suppressed. Click to show