Commit 42c46f3720d86857ef256ad368226093f7768ecd

Authored by Dmitriy Zaporozhets
1 parent ed3f3a0d

Dashboard tabs restyle, messages if no issue or merge request

app/assets/stylesheets/projects.css.scss
@@ -496,14 +496,23 @@ h4.dash-tabs { @@ -496,14 +496,23 @@ h4.dash-tabs {
496 font-weight: bold; text-transform: uppercase; 496 font-weight: bold; text-transform: uppercase;
497 background: #F7F7F7; 497 background: #F7F7F7;
498 margin-bottom:20px; 498 margin-bottom:20px;
  499 + height:13px;
  500 +
499 } 501 }
500 502
501 .dash-button { 503 .dash-button {
502 - margin-right:5px;  
503 - @include round-borders-all(4px);  
504 - border: 1px solid #ddd; 504 + border-right: 1px solid #ddd;
505 background:none; 505 background:none;
  506 + padding: 10px 15px;
  507 + float:left;
  508 + position:relative;
  509 + top:-10px;
  510 + left:0px;
  511 + height:13px;
506 512
  513 + &:first-child {
  514 + border-left: 1px solid #ddd;
  515 + }
507 &.active { 516 &.active {
508 background: #eaeaea; 517 background: #eaeaea;
509 } 518 }
app/controllers/dashboard_controller.rb
@@ -11,9 +11,10 @@ class DashboardController < ApplicationController @@ -11,9 +11,10 @@ class DashboardController < ApplicationController
11 end 11 end
12 end 12 end
13 13
  14 + # Get authored or assigned open merge requests
14 def merge_requests 15 def merge_requests
15 @projects = current_user.projects.all 16 @projects = current_user.projects.all
16 - @merge_requests = current_user.assigned_merge_requests.order("created_at DESC").limit(40) 17 + @merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(40)
17 18
18 respond_to do |format| 19 respond_to do |format|
19 format.html 20 format.html
@@ -21,6 +22,7 @@ class DashboardController < ApplicationController @@ -21,6 +22,7 @@ class DashboardController < ApplicationController
21 end 22 end
22 end 23 end
23 24
  25 + # Get only assigned issues
24 def issues 26 def issues
25 @projects = current_user.projects.all 27 @projects = current_user.projects.all
26 @user = current_user 28 @user = current_user
app/views/dashboard/_issues_feed.html.haml
1 #feeds_content_holder 1 #feeds_content_holder
2 - .project-box.project-updates.ui-box.ui-box-small.ui-box-big  
3 - .data  
4 - - @issues.each do |update|  
5 - %a.project-update{:href => dashboard_feed_path(update.project, update)}  
6 - = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40  
7 - %span.update-title  
8 - = truncate update.title, :length => 50  
9 - .right= update.project.name  
10 - %span.update-author  
11 - %strong= update.author_name  
12 - authored  
13 - = time_ago_in_words(update.created_at)  
14 - ago  
15 - .right  
16 - - if update.critical  
17 - %span.tag.high critical  
18 - - if update.today?  
19 - %span.tag.today today 2 + - unless @issues.empty?
  3 + .project-box.project-updates.ui-box.ui-box-small.ui-box-big
  4 + .data
  5 + - @issues.each do |update|
  6 + %a.project-update{:href => dashboard_feed_path(update.project, update)}
  7 + %strong.issue-number= "##{update.id}"
  8 + %span.update-title
  9 + = truncate update.title, :length => 35
  10 + .right= truncate update.project.name
  11 + %span.update-author
  12 + %strong= update.author_name
  13 + authored
  14 + = time_ago_in_words(update.created_at)
  15 + ago
  16 + .right
  17 + - if update.critical
  18 + %span.tag.high critical
  19 + - if update.today?
  20 + %span.tag.today today
20 21
  22 + - else
  23 + %h2
  24 + No assigned
  25 + %span.tag.open open
  26 + issues
app/views/dashboard/_menu.html.haml
1 %h4.dash-tabs 1 %h4.dash-tabs
2 - = link_to "Activities", dashboard_path, :remote => true, :class => "button-small dash-button #{"active" if current_page?(dashboard_path) || current_page?(root_path) }", :id => "activities_slide"  
3 - = link_to "Issues", dashboard_issues_path, :remote => true, :class => "button-small dash-button #{"active" if current_page?(dashboard_issues_path)}", :id => "issues_slide"  
4 - = link_to "Merge Requests", dashboard_merge_requests_path, :remote => true, :class => "button-small dash-button #{"active" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" 2 + = link_to "Activities", dashboard_path, :remote => true, :class => "dash-button #{"active" if current_page?(dashboard_path) || current_page?(root_path) }", :id => "activities_slide"
  3 + = link_to "Issues", dashboard_issues_path, :remote => true, :class => "dash-button #{"active" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
  4 + = link_to "Merge Requests", dashboard_merge_requests_path, :remote => true, :class => "dash-button #{"active" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
5 = image_tag "ajax-loader-facebook.gif", :class => "dashboard-loader" 5 = image_tag "ajax-loader-facebook.gif", :class => "dashboard-loader"
6 6
7 :javascript 7 :javascript
app/views/dashboard/_merge_requests_feed.html.haml
1 #feeds_content_holder 1 #feeds_content_holder
2 - .project-box.project-updates.ui-box.ui-box-small.ui-box-big  
3 - .data  
4 - - @merge_requests.each do |update|  
5 - %a.project-update{:href => project_merge_request_path(update.project, update)}  
6 - = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40  
7 - %span.update-title  
8 - - state = update.closed ? 'closed' : 'open'  
9 - %span.tag{ :class => state } #{state.capitalize}  
10 - = truncate update.title, :length => 70  
11 - .right= update.project.name  
12 - %span.update-author  
13 - %strong= update.author_name  
14 - authored  
15 - = time_ago_in_words(update.created_at)  
16 - ago  
17 - .right  
18 - %span.tag.commit= update.source_branch  
19 - →  
20 - %span.tag.commit= update.target_branch 2 + - unless @merge_requests.empty?
  3 + .project-box.project-updates.ui-box.ui-box-small.ui-box-big
  4 + .data
  5 + - @merge_requests.each do |update|
  6 + %a.project-update{:href => project_merge_request_path(update.project, update)}
  7 + = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
  8 + %span.update-title
  9 + = truncate update.title, :length => 35
  10 + .right= truncate update.project.name
  11 + %span.update-author
  12 + %strong= update.author_name
  13 + authored
  14 + = time_ago_in_words(update.created_at)
  15 + ago
  16 + .right
  17 + %span.tag.commit= update.source_branch
  18 + →
  19 + %span.tag.commit= update.target_branch
  20 + - else
  21 + %h2
  22 + No authored or assigned
  23 + %span.tag.open open
  24 + merge requests