Commit 09daff61780a2fa391cf1a80bf152cca15740754

Authored by Dmitriy Zaporozhets
1 parent 8d70ac00

Colors for author additions/develtions in graph

app/assets/javascripts/stat_graph_contributors.js.coffee
@@ -19,7 +19,27 @@ class window.ContributorsStatGraph @@ -19,7 +19,27 @@ class window.ContributorsStatGraph
19 author_graph.draw() 19 author_graph.draw()
20 ) 20 )
21 format_author_commit_info: (author) -> 21 format_author_commit_info: (author) ->
22 - author.commits + " commits " + author.additions + " ++ / " + author.deletions + " --" 22 + commits = $('<span/>', {
  23 + class: 'graph-author-commits-count'
  24 + })
  25 + commits.text(author.commits + " commits")
  26 +
  27 + additions = $('<span/>', {
  28 + class: 'graph-additions'
  29 + })
  30 + additions.text(author.additions + " ++")
  31 +
  32 + deletions = $('<span/>', {
  33 + class: 'graph-deletions'
  34 + })
  35 + deletions.text(author.deletions + " --")
  36 +
  37 + $('<span/>').append(commits)
  38 + .append(" / ")
  39 + .append(additions)
  40 + .append(" / ")
  41 + .append(deletions)
  42 +
23 create_author_header: (author) -> 43 create_author_header: (author) ->
24 list_item = $('<li/>', { 44 list_item = $('<li/>', {
25 class: 'person' 45 class: 'person'
@@ -30,7 +50,7 @@ class window.ContributorsStatGraph @@ -30,7 +50,7 @@ class window.ContributorsStatGraph
30 class: 'commits' 50 class: 'commits'
31 }) 51 })
32 author_commit_info = @format_author_commit_info(author) 52 author_commit_info = @format_author_commit_info(author)
33 - author_commit_info_span.text(author_commit_info) 53 + author_commit_info_span.html(author_commit_info)
34 list_item.append(author_name) 54 list_item.append(author_name)
35 list_item.append(author_commit_info_span) 55 list_item.append(author_commit_info_span)
36 list_item 56 list_item
@@ -52,10 +72,10 @@ class window.ContributorsStatGraph @@ -52,10 +72,10 @@ class window.ContributorsStatGraph
52 @field = field 72 @field = field
53 change_date_header: -> 73 change_date_header: ->
54 x_domain = ContributorsGraph.prototype.x_domain 74 x_domain = ContributorsGraph.prototype.x_domain
55 - print_date_format = d3.time.format("%B %e %Y");  
56 - print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1]);  
57 - $("#date_header").text(print); 75 + print_date_format = d3.time.format("%B %e %Y")
  76 + print = print_date_format(x_domain[0]) + " - " + print_date_format(x_domain[1])
  77 + $("#date_header").text(print)
58 redraw_author_commit_info: (author) -> 78 redraw_author_commit_info: (author) ->
59 author_list_item = $(@authors[author.author].list_item) 79 author_list_item = $(@authors[author.author].list_item)
60 author_commit_info = @format_author_commit_info(author) 80 author_commit_info = @format_author_commit_info(author)
61 - author_list_item.find("span").text(author_commit_info)  
62 \ No newline at end of file 81 \ No newline at end of file
  82 + author_list_item.find("span").html(author_commit_info)
app/assets/stylesheets/sections/graph.scss
1 -.graph_holder { 1 +.graph_holder {
2 border: 1px solid #aaa; 2 border: 1px solid #aaa;
3 padding: 1px; 3 padding: 1px;
4 4
5 5
6 - h4 { 6 + h4 {
7 padding: 0 10px; 7 padding: 0 10px;
8 border-bottom: 1px solid #bbb; 8 border-bottom: 1px solid #bbb;
9 @include bg-gray-gradient; 9 @include bg-gray-gradient;
10 } 10 }
11 11
12 - .graph { 12 + .graph {
13 background: #f1f1f1; 13 background: #f1f1f1;
14 height: 500px; 14 height: 500px;
15 overflow-y: scroll; 15 overflow-y: scroll;
@@ -17,3 +17,16 @@ @@ -17,3 +17,16 @@
17 } 17 }
18 } 18 }
19 19
  20 +.graphs {
  21 + .graph-author-commits-count {
  22 + }
  23 +
  24 + .graph-additions {
  25 + color: #4a2;
  26 + }
  27 +
  28 + .graph-deletions {
  29 + color: #d12f19;
  30 + }
  31 +}
  32 +