2018-09-14 05:42:05 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-07-06 17:15:27 +00:00
|
|
|
module DiffForPath
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2016-07-20 16:25:36 +00:00
|
|
|
def render_diff_for_path(diffs)
|
|
|
|
diff_file = diffs.diff_files.find do |diff|
|
2016-11-10 17:24:12 +00:00
|
|
|
diff.file_identifier == params[:file_identifier]
|
2016-07-11 17:17:00 +00:00
|
|
|
end
|
2016-07-06 17:15:27 +00:00
|
|
|
|
|
|
|
return render_404 unless diff_file
|
|
|
|
|
2017-05-15 17:18:19 +00:00
|
|
|
render json: { html: view_to_html_string('projects/diffs/_content', diff_file: diff_file) }
|
2016-07-06 17:15:27 +00:00
|
|
|
end
|
|
|
|
end
|