OSDN Git Service

counters for dashboard panel
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 15 Mar 2012 23:31:46 +0000 (01:31 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 15 Mar 2012 23:31:46 +0000 (01:31 +0200)
app/assets/stylesheets/common.scss
app/controllers/dashboard_controller.rb
app/models/user.rb
app/views/layouts/_app_menu.html.haml

index 9609733..e998b7b 100644 (file)
@@ -43,6 +43,18 @@ a:focus {
   background-color: #474D57;
 }
 
+.pretty_label { 
+  @include round-borders-all(4px);
+  padding:2px 4px;
+  background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.076, #fefefe), to(#F6F7F8));
+  background-image: -webkit-linear-gradient(#fefefe 7.6%, #F6F7F8);
+  background-image: -moz-linear-gradient(#fefefe 7.6%, #F6F7F8);
+  background-image: -o-linear-gradient(#fefefe 7.6%, #F6F7F8);
+  color: #777;
+  border: 1px solid #DEDFE1;
+
+}
+
 .tabs > li > a, .pills > li > a {
   color:$style_color;
 }
index 8fa4129..f6b09e2 100644 (file)
@@ -18,7 +18,7 @@ class DashboardController < ApplicationController
   # Get authored or assigned open merge requests
   def merge_requests
     @projects = current_user.projects.all
-    @merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(40)
+    @merge_requests = current_user.cared_merge_requests.order("created_at DESC").limit(40)
   end
 
   # Get only assigned issues
index 660e5a2..5caa745 100644 (file)
@@ -86,6 +86,10 @@ class User < ActiveRecord::Base
       )
     end
   end
+
+  def cared_merge_requests
+    MergeRequest.where("author_id = :id or assignee_id = :id", :id => self.id).opened
+  end
 end
 # == Schema Information
 #
index 60ff485..e6a6ebf 100644 (file)
@@ -2,6 +2,10 @@
   = render "layouts/const_menu_links"
   = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}"
   = link_to "Search", search_path, :class => "#{"current" if current_page?(search_path)}"
-  = link_to "Issues", dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
-  = link_to "Requests", dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
+  = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do 
+    Issues
+    %span.count= current_user.assigned_issues.opened.count
+  = link_to dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" do
+    Requests
+    %span.count= current_user.cared_merge_requests.count
   = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}"