diff options
-rw-r--r-- | app/assets/stylesheets/gitlab_bootstrap/common.scss | 3 | ||||
-rw-r--r-- | app/controllers/dashboard_controller.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 9 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 7 |
4 files changed, 10 insertions, 11 deletions
diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss index b9459ee6559..85bb5b228df 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/common.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss @@ -46,6 +46,9 @@ color:#888; text-shadow:0 1px 1px #fff; } + i[class^="icon-"] { + line-height:14px; + } } &.active { > a { diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 0ad73f32b5a..af23f970a6d 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -4,7 +4,7 @@ class DashboardController < ApplicationController def index @groups = Group.where(id: current_user.projects.pluck(:group_id)) @projects = current_user.projects_with_events - @projects = @projects.page(params[:page]).per(20) + @projects = @projects.page(params[:page]).per(30) @events = Event.in_projects(current_user.project_ids).limit(20).offset(params[:offset] || 0) @last_push = current_user.recent_push diff --git a/app/models/project.rb b/app/models/project.rb index 3ae15f24b1f..53fe0ee1ccb 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -25,6 +25,7 @@ class Project < ActiveRecord::Base has_many :hooks, dependent: :destroy, class_name: "ProjectHook" has_many :wikis, dependent: :destroy has_many :protected_branches, dependent: :destroy + has_one :last_event, class_name: 'Event', order: 'events.created_at DESC', foreign_key: 'project_id' delegate :name, to: :owner, allow_nil: true, prefix: true @@ -141,15 +142,11 @@ class Project < ActiveRecord::Base end def last_activity - events.order("created_at ASC").last + last_event end def last_activity_date - if events.last - events.last.created_at - else - updated_at - end + last_event.try(:created_at) || updated_at end def wiki_notes diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index b7d846e8c57..f78ce86b266 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -169,10 +169,9 @@ describe Project do describe "last_activity" do let(:project) { Factory :project } - let(:last_event) { double } before do - project.stub_chain(:events, :order).and_return( [ double, double, last_event ] ) + project.stub(last_event: double) end it { project.last_activity.should == last_event } @@ -182,8 +181,8 @@ describe Project do let(:project) { Factory :project } it 'returns the creation date of the project\'s last event if present' do - last_event = double(created_at: 'now') - project.stub(:events).and_return( [double, double, last_event] ) + last_event = double(created_at: Time.now) + project.stub(last_event: last_event) project.last_activity_date.should == last_event.created_at end |