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