Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-29 11:00:29 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-29 11:00:29 +0400
commitc51ac0484f37b65b31cd83b816b151fc7d50cf05 (patch)
tree1be6c9788fc16f65340bed60f97579c2f9a805ee /app/helpers
parent3083753c395722827385cf7542099cf6b4b60c4d (diff)
parentd859d080942175082c1a0cf34d89c0eefd1a3c39 (diff)
Merge pull request #5962 from skv-headless/editing-preview
editing preview
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/commits_helper.rb7
-rw-r--r--app/helpers/tree_helper.rb8
2 files changed, 12 insertions, 3 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index c6e4f574b67..de081acc2ba 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -16,9 +16,10 @@ module CommitsHelper
end
def each_diff_line(diff, index)
- Gitlab::DiffParser.new(diff).each do |full_line, type, line_code, line_new, line_old|
- yield(full_line, type, line_code, line_new, line_old)
- end
+ Gitlab::DiffParser.new(diff.diff.lines.to_a, diff.new_path)
+ .each do |full_line, type, line_code, line_new, line_old|
+ yield(full_line, type, line_code, line_new, line_old)
+ end
end
def each_diff_line_near(diff, index, expected_line_code)
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 50501dffefb..f39d0081dce 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -91,4 +91,12 @@ module TreeHelper
def leave_edit_message
"Leave edit mode?\nAll unsaved changes will be lost."
end
+
+ def editing_preview_title(filename)
+ if gitlab_markdown?(filename) || markup?(filename)
+ 'Preview'
+ else
+ 'Diff'
+ end
+ end
end