From 667edcdd7534206761fc9524e6eaa17f1c27b815 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Sun, 8 Apr 2012 00:18:32 +0300
Subject: [PATCH] Dashboard issues/mr pages improved

---
 app/assets/stylesheets/common.scss           |  3 +++
 app/controllers/dashboard_controller.rb      |  5 ++---
 app/views/dashboard/issues.html.haml         | 21 ++++++++++++++++++--
 app/views/dashboard/merge_requests.html.haml | 21 ++++++++++++++++++--
 4 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index 89e82e7e22e..ee466348d7e 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -406,6 +406,9 @@ img.lil_av {
   border-bottom: 1px solid #eee;
   border-bottom: 1px solid rgba(0, 0, 0, 0.05);
   cursor:pointer;
+  &.smoke { 
+    background-color:#f5f5f5;
+  }
   &:hover { 
     background:$hover;
   }
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index da75465ea32..c28f17167e6 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -19,15 +19,14 @@ class DashboardController < ApplicationController
   # Get authored or assigned open merge requests
   def merge_requests
     @projects = current_user.projects.all
-    @merge_requests = current_user.cared_merge_requests.order("created_at DESC").limit(40)
+    @merge_requests = current_user.cared_merge_requests.order("created_at DESC").page(params[:page]).per(20)
   end
 
   # Get only assigned issues
   def issues
     @projects = current_user.projects.all
     @user   = current_user
-    @issues = current_user.assigned_issues.opened.order("created_at DESC").limit(40)
-
+    @issues = current_user.assigned_issues.opened.order("created_at DESC").page(params[:page]).per(20)
     @issues = @issues.includes(:author, :project)
 
     respond_to do |format|
diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml
index 7b9cd8c42d8..9cb29b382b4 100644
--- a/app/views/dashboard/issues.html.haml
+++ b/app/views/dashboard/issues.html.haml
@@ -3,5 +3,22 @@
   %small (assigned to you)
 
 %br
-- if @issues.any?
-  .ui-box= render "dashboard/issues_feed"
+%div#issues-table-holder.ui-box
+  %title
+  %ul#issues-table.unstyled
+    - if @issues.any?
+      - @issues.group_by(&:project).each do |group|
+        %li.wll.smoke
+          - project = group[0]
+          = project.name
+        - group[1].each do |issue|
+          = render(:partial => 'issues/show', :locals => {:issue => issue})
+      %li.bottom
+        .row
+          .span10= paginate @issues, :theme => "gitlab"
+          .span4.right
+            %span.cgray.right #{@issues.total_count} issues
+
+    - else
+      %li
+        %p.padded Nothing to show here
diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml
index 6720a81f466..6e85b19a02d 100644
--- a/app/views/dashboard/merge_requests.html.haml
+++ b/app/views/dashboard/merge_requests.html.haml
@@ -3,5 +3,22 @@
   %small (authored or assigned to you)
 
 %br
-- if @merge_requests.any?
-  .ui-box= render "dashboard/merge_requests_feed"
+%div#merge_requests-table-holder.ui-box
+  %title
+  %ul#merge_requests-table.unstyled
+    - if @merge_requests.any?
+      - @merge_requests.group_by(&:project).each do |group|
+        %li.wll.smoke
+          - project = group[0]
+          = project.name
+        - group[1].each do |merge_request|
+          = render(:partial => 'merge_requests/merge_request', :locals => {:merge_request => merge_request})
+      %li.bottom
+        .row
+          .span10= paginate @merge_requests, :theme => "gitlab"
+          .span4.right
+            %span.cgray.right #{@merge_requests.total_count} merge requests
+
+    - else
+      %li
+        %p.padded Nothing to show here
-- 
GitLab