Commit f8b5e5f7 authored by gitlabhq's avatar gitlabhq

dashboard

parent 1a03b17a
...@@ -6,7 +6,7 @@ class ProjectsController < ApplicationController ...@@ -6,7 +6,7 @@ class ProjectsController < ApplicationController
before_filter :authorize_read_project!, :except => [:index, :new, :create] before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
before_filter :require_non_empty_project, :only => [:blob, :tree, :show] before_filter :require_non_empty_project, :only => [:blob, :tree]
def index def index
@projects = current_user.projects.all @projects = current_user.projects.all
...@@ -60,21 +60,25 @@ class ProjectsController < ApplicationController ...@@ -60,21 +60,25 @@ class ProjectsController < ApplicationController
end end
def show def show
@date = case params[:view] if @project.repo_exists?
when "week" then Date.today - 7.days @date = case params[:view]
else Date.today when "week" then Date.today - 7.days
end else Date.today
end
@heads = @project.repo.heads
@commits = @heads.map do |h| @heads = @project.repo.heads
@project.repo.log(h.name, nil, :since => @date - 1.day) @commits = @heads.map do |h|
end.flatten.uniq { |c| c.id } @project.repo.log(h.name, nil, :since => @date - 1.day)
end.flatten.uniq { |c| c.id }
@commits.sort! do |x, y|
y.committed_date <=> x.committed_date @commits.sort! do |x, y|
end y.committed_date <=> x.committed_date
end
@messages = project.notes.since(@date).limit(40).order("created_at DESC") @messages = project.notes.since(@date).limit(40).order("created_at DESC")
else
return render "projects/empty"
end
end end
# #
......
...@@ -72,7 +72,10 @@ describe "Projects" do ...@@ -72,7 +72,10 @@ describe "Projects" do
current_path.should == project_path(@project) current_path.should == project_path(@project)
end end
it_behaves_like :tree_view it "should beahave like dashboard" do
page.should have_content("Recent history")
end
end end
describe "GET /projects/team" do describe "GET /projects/team" do
...@@ -134,8 +137,6 @@ describe "Projects" do ...@@ -134,8 +137,6 @@ describe "Projects" do
it "should show project" do it "should show project" do
page.should have_content("Awesome") page.should have_content("Awesome")
end end
it_behaves_like :tree_view
end end
#describe "DELETE /projects/:id", :js => true do #describe "DELETE /projects/:id", :js => true do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment