Commit 75cf927d3b1f31c7c19ce08d34bce4bf15f21608

Authored by Dmitriy Zaporozhets
1 parent b64ceadb

Issues & MR legend

app/assets/stylesheets/common.scss
@@ -606,3 +606,92 @@ li.note { @@ -606,3 +606,92 @@ li.note {
606 .mr_show_all_commits { 606 .mr_show_all_commits {
607 cursor:pointer; 607 cursor:pointer;
608 } 608 }
  609 +
  610 +/**
  611 + * Issues, MRs legend
  612 + *
  613 + */
  614 +
  615 +.list_legend {
  616 + float:left;
  617 + margin-right:20px;
  618 + .icon {
  619 + width:16px;
  620 + height:16px;
  621 + float:left;
  622 + margin-right:5px;
  623 + @include border-radius(4px);
  624 + &.critical {
  625 + background: #EAA;
  626 + border:1px solid #B88;
  627 + }
  628 + &.today{
  629 + background: #ADA;
  630 + border:1px solid #8B8;
  631 + }
  632 + &.closed {
  633 + background: #DDD;
  634 + border:1px solid #BBB;
  635 + }
  636 + &.yours {
  637 + background: #AAD;
  638 + border:1px solid #88B;
  639 + }
  640 + &.merged {
  641 + background: #DAD;
  642 + border:1px solid #B8B;
  643 + }
  644 + }
  645 + .text {
  646 + padding-bottom: 10px;
  647 + float:left;
  648 + }
  649 +}
  650 +
  651 +.merge_request,
  652 +.issue {
  653 + .list_legend {
  654 + margin-right: 5px;
  655 + margin-top: 10px;
  656 + .icon {
  657 + width:16px;
  658 + height:16px;
  659 + float:left;
  660 + margin-right:5px;
  661 + @include border-radius(4px);
  662 + border:1px solid #ddd;
  663 + }
  664 + }
  665 +
  666 + &.critical {
  667 + .icon {
  668 + background: #EAA;
  669 + border:1px solid #B88;
  670 + }
  671 + }
  672 + &.today{
  673 + .icon {
  674 + background: #ADA;
  675 + border:1px solid #8B8;
  676 + }
  677 + }
  678 + &.closed {
  679 + .icon {
  680 + background: #DDD;
  681 + border:1px solid #BBB;
  682 + }
  683 + }
  684 + &.yours {
  685 + .icon {
  686 + background: #AAD;
  687 + border:1px solid #88B;
  688 + }
  689 + }
  690 + &.merged {
  691 + .icon {
  692 + background: #DAD;
  693 + border:1px solid #B8B;
  694 + }
  695 + }
  696 +}
  697 +
app/assets/stylesheets/sections/issues.scss
@@ -25,3 +25,5 @@ @@ -25,3 +25,5 @@
25 @extend .bottom_box_content; 25 @extend .bottom_box_content;
26 } 26 }
27 } 27 }
  28 +
  29 +
app/helpers/issues_helper.rb
@@ -25,4 +25,12 @@ module IssuesHelper @@ -25,4 +25,12 @@ module IssuesHelper
25 issue.author_name 25 issue.author_name
26 end 26 end
27 end 27 end
  28 +
  29 + def issue_css_classes issue
  30 + classes = "issue"
  31 + classes << " critical" if issue.critical
  32 + classes << " closed" if issue.closed
  33 + classes << " today" if issue.today?
  34 + classes
  35 + end
28 end 36 end
app/helpers/merge_requests_helper.rb
@@ -31,4 +31,12 @@ module MergeRequestsHelper @@ -31,4 +31,12 @@ module MergeRequestsHelper
31 } 31 }
32 ) 32 )
33 end 33 end
  34 +
  35 + def mr_css_classes mr
  36 + classes = "merge_request"
  37 + classes << " closed" if mr.closed
  38 + classes << " merged" if mr.merged?
  39 + classes << " today" if mr.today?
  40 + classes
  41 + end
34 end 42 end
app/models/merge_request.rb
@@ -93,6 +93,10 @@ class MergeRequest &lt; ActiveRecord::Base @@ -93,6 +93,10 @@ class MergeRequest &lt; ActiveRecord::Base
93 self.save 93 self.save
94 end 94 end
95 95
  96 + def today?
  97 + Date.today == created_at.to_date
  98 + end
  99 +
96 def new? 100 def new?
97 today? && created_at == updated_at 101 today? && created_at == updated_at
98 end 102 end
app/views/dashboard/issues.html.haml
@@ -4,6 +4,15 @@ @@ -4,6 +4,15 @@
4 %small.right #{@issues.total_count} issues 4 %small.right #{@issues.total_count} issues
5 5
6 %br 6 %br
  7 +.issues_legend
  8 + .list_legend
  9 + .icon.critical
  10 + .text Critical
  11 +
  12 + .list_legend
  13 + .icon.today
  14 + .text Today
  15 +.clearfix
7 - if @issues.any? 16 - if @issues.any?
8 - @issues.group_by(&:project).each do |group| 17 - @issues.group_by(&:project).each do |group|
9 %div.ui-box 18 %div.ui-box
app/views/issues/_show.html.haml
1 -%li.wll{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) } 1 +%li.wll{ :id => dom_id(issue), :class => issue_css_classes(issue), :url => project_issue_path(issue.project, issue) }
  2 + .list_legend
  3 + .icon
2 .right 4 .right
3 - if issue.notes.any? 5 - if issue.notes.any?
4 %span.btn.small.disabled.padded= pluralize issue.notes.count, 'note' 6 %span.btn.small.disabled.padded= pluralize issue.notes.count, 'note'
@@ -15,12 +17,8 @@ @@ -15,12 +17,8 @@
15 %span.update-author 17 %span.update-author
16 assigned to 18 assigned to
17 %strong= issue.assignee_name 19 %strong= issue.assignee_name
18 - - if issue.critical  
19 - %span.label.important critical  
20 - - if issue.today?  
21 - %span.label.success today  
22 - if issue.upvotes > 0 20 - if issue.upvotes > 0
23 - %span.label.success= "+#{issue.upvotes}" 21 + %span.badge.badge-success= "+#{issue.upvotes}"
24 22
25 = link_to project_issue_path(issue.project, issue) do 23 = link_to project_issue_path(issue.project, issue) do
26 %p.row_title= truncate(issue.title, :length => 100) 24 %p.row_title= truncate(issue.title, :length => 100)
app/views/issues/index.html.haml
@@ -14,6 +14,21 @@ @@ -14,6 +14,21 @@
14 = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search span3 right neib' } 14 = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search span3 right neib' }
15 15
16 %br 16 %br
  17 +
  18 + .issues_legend
  19 + .list_legend
  20 + .icon.critical
  21 + .text Critical
  22 +
  23 + .list_legend
  24 + .icon.closed
  25 + .text Closed
  26 +
  27 + .list_legend
  28 + .icon.today
  29 + .text Today
  30 + .clearfix
  31 +
17 %div#issues-table-holder.ui-box 32 %div#issues-table-holder.ui-box
18 .title 33 .title
19 .row 34 .row
app/views/merge_requests/_merge_request.html.haml
1 -%li.wll 1 +%li.wll{ :class => mr_css_classes(merge_request) }
  2 + .list_legend
  3 + .icon
2 .right 4 .right
3 .left 5 .left
4 - if merge_request.notes.any? 6 - if merge_request.notes.any?
@@ -14,6 +16,6 @@ @@ -14,6 +16,6 @@
14 = time_ago_in_words(merge_request.created_at) 16 = time_ago_in_words(merge_request.created_at)
15 ago 17 ago
16 - if merge_request.upvotes > 0 18 - if merge_request.upvotes > 0
17 - %span.label.success= "+#{merge_request.upvotes}" 19 + %span.badge.badge-success= "+#{merge_request.upvotes}"
18 = link_to project_merge_request_path(merge_request.project, merge_request) do 20 = link_to project_merge_request_path(merge_request.project, merge_request) do
19 %p.row_title= truncate(merge_request.title, :length => 80) 21 %p.row_title= truncate(merge_request.title, :length => 80)
app/views/merge_requests/index.html.haml
@@ -6,6 +6,20 @@ @@ -6,6 +6,20 @@
6 6
7 %br 7 %br
8 8
  9 +.mrs_legend
  10 + .list_legend
  11 + .icon.today
  12 + .text Today
  13 +
  14 + .list_legend
  15 + .icon.merged
  16 + .text Merged
  17 +
  18 + .list_legend
  19 + .icon.closed
  20 + .text Closed
  21 +.clearfix
  22 +
9 .ui-box 23 .ui-box
10 .title 24 .title
11 %ul.nav.nav-pills 25 %ul.nav.nav-pills
@@ -26,7 +40,7 @@ @@ -26,7 +40,7 @@
26 = render @merge_requests 40 = render @merge_requests
27 - if @merge_requests.blank? 41 - if @merge_requests.blank?
28 %li 42 %li
29 - %p.padded Nothing to show here 43 + %h4.nothing_here_message Nothing to show here
30 - if @merge_requests.present? 44 - if @merge_requests.present?
31 %li.bottom 45 %li.bottom
32 .row 46 .row