debian-mirror-gitlab/app/controllers/concerns/diff_for_path.rb

16 lines
375 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2016-08-24 12:49:21 +05:30
module DiffForPath
extend ActiveSupport::Concern
2016-09-13 17:45:13 +05:30
def render_diff_for_path(diffs)
diff_file = diffs.diff_files.find do |diff|
2017-08-17 22:00:37 +05:30
diff.file_identifier == params[:file_identifier]
2016-08-24 12:49:21 +05:30
end
return render_404 unless diff_file
2017-09-10 17:25:29 +05:30
render json: { html: view_to_html_string('projects/diffs/_content', diff_file: diff_file) }
2016-08-24 12:49:21 +05:30
end
end