Commit 6667f3dbf920d9bcf0e6f3218d27c92811f74224

Authored by Dmitriy Zaporozhets
1 parent d23022c6

Colored labels for events

app/assets/stylesheets/sections/events.scss
@@ -3,33 +3,35 @@ @@ -3,33 +3,35 @@
3 * 3 *
4 */ 4 */
5 .event_label { 5 .event_label {
6 - /*@extend .label;*/  
7 - /*background-color: #999;*/  
8 -  
9 - /*&.pushed {*/  
10 - /*background-color: #4A97BD;*/  
11 - /*}*/  
12 -  
13 - /*&.opened {*/  
14 - /*background-color: #469847;*/  
15 - /*}*/ 6 + &.pushed {
  7 + padding:0 2px;
  8 + @extend .alert;
  9 + @extend .alert-info;
  10 + }
16 11
17 - /*&.closed {*/  
18 - /*background-color: #B94A48;*/  
19 - /*}*/ 12 + &.opened {
  13 + padding:0 2px;
  14 + @extend .alert;
  15 + @extend .alert-success;
  16 + }
20 17
21 - /*&.merged {*/  
22 - /*background-color: #2A2;*/  
23 - /*}*/ 18 + &.closed {
  19 + padding:0 2px;
  20 + @extend .alert;
  21 + @extend .alert-error;
  22 + }
24 23
25 - /*&.joined {*/  
26 - /*background-color: #1ca9dd;*/  
27 - /*}*/ 24 + &.merged {
  25 + padding:0 2px;
  26 + @extend .alert;
  27 + @extend .alert-success;
  28 + }
28 29
29 - /*&.left {*/  
30 - /*background-color: #888;*/  
31 - /*float:none;*/  
32 - /*}*/ 30 + &.left,
  31 + &.joined {
  32 + padding:0 2px;
  33 + @extend .alert;
  34 + }
33 } 35 }
34 36
35 /** 37 /**
@@ -43,13 +45,16 @@ @@ -43,13 +45,16 @@
43 color:#333; 45 color:#333;
44 font-weight: bold; 46 font-weight: bold;
45 .author_name { 47 .author_name {
46 - color:#777; 48 + color:#333;
47 } 49 }
48 } 50 }
49 .event-body { 51 .event-body {
50 p { 52 p {
51 color:#666; 53 color:#666;
52 } 54 }
  55 + .event-info {
  56 + color:#666;
  57 + }
53 } 58 }
54 .avatar { 59 .avatar {
55 width:32px; 60 width:32px;
app/models/event.rb
@@ -132,6 +132,7 @@ class Event < ActiveRecord::Base @@ -132,6 +132,7 @@ class Event < ActiveRecord::Base
132 end 132 end
133 end 133 end
134 134
  135 +
135 delegate :name, :email, to: :author, prefix: true, allow_nil: true 136 delegate :name, :email, to: :author, prefix: true, allow_nil: true
136 delegate :title, to: :issue, prefix: true, allow_nil: true 137 delegate :title, to: :issue, prefix: true, allow_nil: true
137 delegate :title, to: :merge_request, prefix: true, allow_nil: true 138 delegate :title, to: :merge_request, prefix: true, allow_nil: true
app/views/events/_event_issue.html.haml
1 = image_tag gravatar_icon(event.author_email), class: "avatar" 1 = image_tag gravatar_icon(event.author_email), class: "avatar"
2 .event-title 2 .event-title
3 %strong.author_name #{event.author_name} 3 %strong.author_name #{event.author_name}
4 - %span.event_label{class: event.action_name}= event.action_name  
5 - issue 4 + %span.event_label{class: event.action_name} #{event.action_name} issue
6 = link_to project_issue_path(event.project, event.issue) do 5 = link_to project_issue_path(event.project, event.issue) do
7 %strong= truncate event.issue_title 6 %strong= truncate event.issue_title
8 at 7 at
app/views/events/_event_membership_changed.html.haml
1 = image_tag gravatar_icon(event.author_email), class: "avatar" 1 = image_tag gravatar_icon(event.author_email), class: "avatar"
2 .event-title 2 .event-title
3 %strong.author_name #{event.author_name} 3 %strong.author_name #{event.author_name}
4 - %span.event_label{class: event.action_name}= event.action_name  
5 - project 4 + %span.event_label{class: event.action_name} #{event.action_name} project
6 %strong= link_to event.project_name, event.project 5 %strong= link_to event.project_name, event.project
7 %span.cgray 6 %span.cgray
8 = time_ago_in_words(event.created_at) 7 = time_ago_in_words(event.created_at)
app/views/events/_event_merge_request.html.haml
@@ -3,14 +3,14 @@ @@ -3,14 +3,14 @@
3 = image_tag gravatar_icon(event.author_email), class: "avatar" 3 = image_tag gravatar_icon(event.author_email), class: "avatar"
4 .event-title 4 .event-title
5 %strong.author_name #{event.author_name} 5 %strong.author_name #{event.author_name}
6 - %span.event_label{class: event.action_name}= event.action_name  
7 - merge request 6 + %span.event_label{class: event.action_name} #{event.action_name} merge request
8 = link_to project_merge_request_path(event.project, event.merge_request) do 7 = link_to project_merge_request_path(event.project, event.merge_request) do
9 %strong= truncate event.merge_request_title 8 %strong= truncate event.merge_request_title
10 at 9 at
11 %strong= link_to event.project.name, event.project 10 %strong= link_to event.project.name, event.project
12 .event-body 11 .event-body
13 - %span= event.merge_request.source_branch  
14 - →  
15 - %span= event.merge_request.target_branch 12 + .event-info
  13 + %span= event.merge_request.source_branch
  14 + →
  15 + %span= event.merge_request.target_branch
16 16
app/views/events/_event_push.html.haml
@@ -4,8 +4,7 @@ @@ -4,8 +4,7 @@
4 4
5 .event-title 5 .event-title
6 %strong.author_name #{event.author_name} 6 %strong.author_name #{event.author_name}
7 - %span.event_label.pushed= event.push_action_name  
8 - = event.ref_type 7 + %span.event_label.pushed #{event.push_action_name} #{event.ref_type}
9 = link_to project_commits_path(event.project, ref: event.ref_name) do 8 = link_to project_commits_path(event.project, ref: event.ref_name) do
10 %strong= event.ref_name 9 %strong= event.ref_name
11 at 10 at