diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-17 23:02:52 +0400 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-17 23:02:52 +0400 |
commit | e0c43c46ddd7f9488ef076e0c91800e43bd376b3 (patch) | |
tree | 7d6bce048db302743418e3ad723a29bbb86d4bd0 /app | |
parent | a9a3480de97296234fad349fe25aac6f11cf9285 (diff) |
Added project has_one :last_event assoc. Fixed tab line-height after font-awesome. Increased projects per page on dashboard
Diffstat (limited to 'app')
-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 |
3 files changed, 7 insertions, 7 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 |