recent radio button
This commit is contained in:
parent
977fe73073
commit
24f04c0a61
6 changed files with 54 additions and 21 deletions
|
@ -60,24 +60,21 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
if @project.repo_exists?
|
||||
@date = case params[:view]
|
||||
when "week" then Date.today - 7.days
|
||||
else Date.today
|
||||
end.at_beginning_of_day
|
||||
return render "projects/empty" unless @project.repo_exists?
|
||||
@date = case params[:view]
|
||||
when "week" then Date.today - 7.days
|
||||
when "day" then Date.today
|
||||
else nil
|
||||
end
|
||||
|
||||
@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
|
||||
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"
|
||||
else
|
||||
@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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue