debian-mirror-gitlab/app/controllers/projects/commits_controller.rb

31 lines
844 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
require "base64"
class Projects::CommitsController < Projects::ApplicationController
include ExtractsPath
2015-09-11 14:41:01 +05:30
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
2014-09-02 18:07:02 +05:30
def show
@limit, @offset = (params[:limit] || 40).to_i, (params[:offset] || 0).to_i
search = params[:search]
@commits =
if search.present?
@repository.find_commits_by_message(search, @ref, @path, @limit, @offset).compact
else
@repository.commits(@ref, @path, @limit, @offset)
end
2014-09-02 18:07:02 +05:30
2015-11-26 14:37:03 +05:30
@note_counts = project.notes.where(commit_id: @commits.map(&:id)).
2015-04-26 12:48:37 +05:30
group(:commit_id).count
2014-09-02 18:07:02 +05:30
respond_to do |format|
2015-04-26 12:48:37 +05:30
format.html
2014-09-02 18:07:02 +05:30
format.json { pager_json("projects/commits/_commits", @commits.size) }
format.atom { render layout: false }
end
end
end