Commit 7f76d6cfee7f95e6d89691431540e8d948ca60ec

Authored by Dmitriy Zaporozhets
1 parent 5d2bd5ec

counters for dashboard panel

app/assets/stylesheets/common.scss
... ... @@ -43,6 +43,18 @@ a:focus {
43 43 background-color: #474D57;
44 44 }
45 45  
  46 +.pretty_label {
  47 + @include round-borders-all(4px);
  48 + padding:2px 4px;
  49 + background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.076, #fefefe), to(#F6F7F8));
  50 + background-image: -webkit-linear-gradient(#fefefe 7.6%, #F6F7F8);
  51 + background-image: -moz-linear-gradient(#fefefe 7.6%, #F6F7F8);
  52 + background-image: -o-linear-gradient(#fefefe 7.6%, #F6F7F8);
  53 + color: #777;
  54 + border: 1px solid #DEDFE1;
  55 +
  56 +}
  57 +
46 58 .tabs > li > a, .pills > li > a {
47 59 color:$style_color;
48 60 }
... ...
app/controllers/dashboard_controller.rb
... ... @@ -18,7 +18,7 @@ class DashboardController < ApplicationController
18 18 # Get authored or assigned open merge requests
19 19 def merge_requests
20 20 @projects = current_user.projects.all
21   - @merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(40)
  21 + @merge_requests = current_user.cared_merge_requests.order("created_at DESC").limit(40)
22 22 end
23 23  
24 24 # Get only assigned issues
... ...
app/models/user.rb
... ... @@ -86,6 +86,10 @@ class User < ActiveRecord::Base
86 86 )
87 87 end
88 88 end
  89 +
  90 + def cared_merge_requests
  91 + MergeRequest.where("author_id = :id or assignee_id = :id", :id => self.id).opened
  92 + end
89 93 end
90 94 # == Schema Information
91 95 #
... ...
app/views/layouts/_app_menu.html.haml
... ... @@ -2,6 +2,10 @@
2 2 = render "layouts/const_menu_links"
3 3 = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}"
4 4 = link_to "Search", search_path, :class => "#{"current" if current_page?(search_path)}"
5   - = link_to "Issues", dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
6   - = link_to "Requests", dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
  5 + = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do
  6 + Issues
  7 + %span.count= current_user.assigned_issues.opened.count
  8 + = link_to dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" do
  9 + Requests
  10 + %span.count= current_user.cared_merge_requests.count
7 11 = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}"
... ...