| ... | ... | @@ -60,24 +60,21 @@ class ProjectsController < ApplicationController |
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
if @project.repo_exists?
|
|
|
|
return render "projects/empty" unless @project.repo_exists?
|
|
|
|
@date = case params[:view]
|
|
|
|
when "week" then Date.today - 7.days
|
|
|
|
else Date.today
|
|
|
|
end.at_beginning_of_day
|
|
|
|
|
|
|
|
@heads = @project.repo.heads
|
|
|
|
@commits = @heads.map do |h|
|
|
|
|
@project.repo.log(h.name, nil, :since => @date)
|
|
|
|
end.flatten.uniq { |c| c.id }
|
|
|
|
|
|
|
|
@commits.sort! do |x, y|
|
|
|
|
y.committed_date <=> x.committed_date
|
|
|
|
when "day" then Date.today
|
|
|
|
else nil
|
|
|
|
end
|
|
|
|
|
|
|
|
if @date
|
|
|
|
@date = @date.at_beginning_of_day
|
|
|
|
|
|
|
|
@commits = @project.commits_since(@date)
|
|
|
|
@messages = project.notes.since(@date).order("created_at DESC")
|
|
|
|
else
|
|
|
|
return render "projects/empty"
|
|
|
|
@commits = @project.fresh_commits
|
|
|
|
@messages = project.notes.fresh.limit(10)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
| ... | ... | @@ -89,11 +86,12 @@ class ProjectsController < ApplicationController |
|
|
|
@date = case params[:view]
|
|
|
|
when "week" then Date.today - 7.days
|
|
|
|
when "all" then nil
|
|
|
|
else Date.today
|
|
|
|
when "day" then Date.today
|
|
|
|
else nil
|
|
|
|
end
|
|
|
|
|
|
|
|
@notes = @project.common_notes.order("created_at DESC")
|
|
|
|
@notes = @notes.since(@date.at_beginning_of_day) if @date
|
|
|
|
@notes = @date ? @notes.since(@date.at_beginning_of_day) : @notes.fresh.limit(10)
|
|
|
|
@note = Note.new
|
|
|
|
end
|
|
|
|
|
| ... | ... | |
| ... | ... | |