Commit 1e1c5b7afe42d6d88997aaa4f4877c37965866a5
1 parent
279c4262
Exists in
master
and in
4 other branches
Diff refactoring
Showing
2 changed files
with
6 additions
and
6 deletions
Show diff stats
app/helpers/commits_helper.rb
| ... | ... | @@ -17,7 +17,7 @@ module CommitsHelper |
| 17 | 17 | preserve out |
| 18 | 18 | end |
| 19 | 19 | |
| 20 | - def diff_line_class(line) | |
| 20 | + def identification_type(line) | |
| 21 | 21 | if line[0] == "+" |
| 22 | 22 | "new" |
| 23 | 23 | elsif line[0] == "-" |
| ... | ... | @@ -27,7 +27,7 @@ module CommitsHelper |
| 27 | 27 | end |
| 28 | 28 | end |
| 29 | 29 | |
| 30 | - def build_line_code(line, index, line_new, line_old) | |
| 30 | + def build_line_anchor(index, line_new, line_old) | |
| 31 | 31 | "#{index}_#{line_old}_#{line_new}" |
| 32 | 32 | end |
| 33 | 33 | |
| ... | ... | @@ -51,12 +51,12 @@ module CommitsHelper |
| 51 | 51 | line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0 |
| 52 | 52 | line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0 |
| 53 | 53 | |
| 54 | - next if line_old == 1 && line_new == 1 | |
| 54 | + next if line_old == 1 && line_new == 1 #top of file | |
| 55 | 55 | yield(full_line, type, nil, nil, nil) |
| 56 | 56 | next |
| 57 | 57 | else |
| 58 | - type = diff_line_class(line) | |
| 59 | - line_code = build_line_code(line, index, line_new, line_old) | |
| 58 | + type = identification_type(line) | |
| 59 | + line_code = build_line_anchor(index, line_new, line_old) | |
| 60 | 60 | yield(full_line, type, line_code, line_new, line_old) |
| 61 | 61 | end |
| 62 | 62 | ... | ... |
app/views/commits/_text_file.html.haml