Skip to content

Commit

Permalink
Overhaul stats page to factor out common view code and make consisten…
Browse files Browse the repository at this point in the history
…t with commit search.
  • Loading branch information
cespare committed Sep 27, 2011
1 parent 8cf3593 commit 1d3a23d
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 113 deletions.
107 changes: 54 additions & 53 deletions public/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -356,30 +356,36 @@ header {

.handle { cursor: move; }

.savedSearch {
.savedSearch, .statistic {
position: relative;
/* We want the background of a saved search to be opaque while we're dragging it around. */
background-image: url(/images/background.png);
padding-bottom: 20px;
margin-bottom: 8px;
padding-right: 30px;
width: 100%;
/* overflow is hidden because we slide pages of commits in saved searches off the edges of the page. */
overflow: hidden;

.header {
margin-bottom: 5px;
padding-bottom: 3px;
border-bottom: @standardBorder;

.name {
width: 750px;
overflow: hidden;
white-space: nowrap;
font-size: 16px;
font-weight: normal;
}
}
}

.savedSearch, .statistic.chattyCommits {
width: 100%;

.header {
.name {
width: 750px;
overflow: hidden;
white-space: nowrap;
}
.dragHandle {
position: absolute;
right: 0;
Expand Down Expand Up @@ -473,7 +479,6 @@ header {
}
}


/*
* Styles for list of commits
*/
Expand Down Expand Up @@ -550,6 +555,48 @@ table.commitsList, table.authorList {
}
}

#stats {
#statistics {
.statistic {
border-collapse: collapse;
&.topReviewers {
margin-top: 30px;
display: inline-block;
.authorList {
width: @pageWidth * 0.5;
td.email {
color: @lightTextColor;
font-size: 90%;
text-align: right;
}
td.count {
width: 100%;
color: @lightTextColor;
}
}
}

&.reviewCoverage {
margin-top: 30px;
display: inline-block;
float: right;

.graph {
margin-top: 30px;
width: 300px;
height: 300px;
}
}

.commitsList {
width: @pageWidth;
td.selectArrow { max-width: 0; }
}
}
}
}


/*
* Layout for the commits dashboard page.
*/
Expand Down Expand Up @@ -1027,52 +1074,6 @@ table.commitsList, table.authorList {
}
}

#stats {
#statistics {
.statistic {
margin-top: 50px;

h3 {
color: #636363;
margin-bottom: 20px;
border-bottom: 1px solid #ADADAD;
}

&.topReviewers {
display: inline-block;

.authorList {
width: inherit;
td { padding: 0px 10px; }
.email {
color: #666666;
font-size: 0.9em;
}
.count { color: #666666; }
}
}

&.reviewCoverage {
display: inline-block;
float: right;

.graph {
width: 300px;
height: 300px;
}
}

.commitsList {
td { padding: 0px 10px; }
.count {
color: #666666;
white-space: nowrap;
}
}
}
}
}

#inspire {
#quote {
margin: 100px auto 30px auto;
Expand Down
42 changes: 42 additions & 0 deletions views/_commit_line.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<%#
A single compact tr with commit metadata.
View arguments:
- commit: a grit commit.
%>
<% db_commit = MetaRepo.instance.db_commit(commit.repo_name, commit.sha) %>
<tr>
<td class="selectArrow"></td>
<td class="avatarCell">
<a href="/profile/<%= commit.author.user.id %>" target="_blank">
<div class="avatar">
<img src="<%= commit.author.user.gravatar %>"/>
</div>
</a>
</td>
<td class="author">
<a class="west" rel="tipsy" href="/profile/<%= commit.author.user.id %>" target="_blank"
title="<%= commit.author.email %>"><%= commit.author.to_s[0..25] %></a>
</td>
<td class="commitId">
<a href="<%= commit.link %>" target="_blank" class="commitLink"><%= commit.id_abbrev %></a>
</td>
<td class="approval">
<% if db_commit.approved? %>
<a class="south" rel="tipsy" title="Approved"><img src="/images/checkmark.png" /></a>
<% end %>
</td>
<td class="commitMessage">
<a href="<%= commit.link %>" target="_blank"><%= CGI::escapeHTML(commit.short_message) %></a>
</td>
<td class="commitDate"><%= commit.date.to_pretty %></td>
<td class="commitRepo"><%= commit.repo_name %></td>
<td class="commentCount">
<% comment_count = db_commit.comment_count %>
<% if comment_count > 0 %>
<% comment_count_hover_text = "#{comment_count} comment#{'s' unless comment_count == 1}" %>
<a class="noLink east" rel="tipsy" title="<%= comment_count_hover_text %>">
<span><%= comment_count %></span><img src="images/comment_bubble.png" />
</a>
<% end %>
</td>
</tr>
38 changes: 1 addition & 37 deletions views/_saved_search.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,43 +35,7 @@
<% else %>
<table class="commitsList">
<% commits.each do |commit| %>
<% db_commit = MetaRepo.instance.db_commit(commit.repo_name, commit.sha) %>
<tr>
<td class="selectArrow"></td>
<td class="avatarCell">
<a href="/profile/<%= commit.author.user.id %>" target="_blank">
<div class="avatar">
<img src="<%= commit.author.user.gravatar %>"/>
</div>
</a>
</td>
<td class="author">
<a class="west" rel="tipsy" href="/profile/<%= commit.author.user.id %>" target="_blank"
title="<%= commit.author.email %>"><%= commit.author.to_s[0..25] %></a>
</td>
<td class="commitId">
<a href="<%= commit.link %>" target="_blank" class="commitLink"><%= commit.id_abbrev %></a>
</td>
<td class="approval">
<% if db_commit.approved? %>
<a class="south" rel="tipsy" title="Approved"><img src="/images/checkmark.png" /></a>
<% end %>
</td>
<td class="commitMessage">
<a href="<%= commit.link %>" target="_blank"><%= CGI::escapeHTML(commit.short_message) %></a>
</td>
<td class="commitDate"><%= commit.date.to_pretty %></td>
<td class="commitRepo"><%= commit.repo_name %></td>
<td class="commentCount">
<% comment_count = db_commit.comment_count %>
<% if comment_count > 0 %>
<% comment_count_hover_text = "#{comment_count} comment#{'s' unless comment_count == 1}" %>
<a class="noLink east" rel="tipsy" title="<%= comment_count_hover_text %>">
<span><%= comment_count %></span><img src="images/comment_bubble.png" />
</a>
<% end %>
</td>
</tr>
<%= erb :_commit_line, :layout => false, :locals => { :commit => commit } %>
<% end %>
</table>
<% end %>
Expand Down
35 changes: 12 additions & 23 deletions views/stats.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,27 @@
<% end %>
<div id="statistics">
<div class="statistic topReviewers">
<h3>Most comment activity</h3>
<div class="header"><div class="name">Most comment activity</div></div>
<table class="authorList">
<% top_reviewers.each do |user, count| %>
<tr>
<td><a href="/profile/<%= user.id %>">
<td class="avatarCell"><a href="/profile/<%= user.id %>">
<img class="avatar" src="<%= user.gravatar %>"/></a></td>
<td class="author">
<a href="/profile/<%= user.id %>"
title="<%= user.email %>"><%= user.name[0..25] %></a>
<span class="count">with <%= count %> comments</span></td>
<a href="/profile/<%= user.id %>" rel="tipsy" class="west" title="<%= user.email %>">
<%= user.name[0..25] %></a>
</td>
<td class="count">with <%= count %> comments</td>
<td class="email">
<a href="mailto:<%= user.email %>"
title="<%= user.email %>"><%= user.email %></a></td>
<a href="mailto:<%= user.email %>" rel="tipsy" class="east" title="Email"><%= user.email %>
</a>
</td>
</tr>
<% end %>
</table>
</div>
<div class="statistic reviewCoverage">
<h3>Review Coverage</h3>
<div class="header"><div class="name">Review Coverage</div></div>
<% if num_commits == 0 %>
<span>No commits within this time range.</span>
<% end %>
Expand All @@ -48,23 +50,10 @@
<!-- NOTE(dmac): The Flot canvas isn't playing nice with our css, so we're resorting to a float clear. -->
<div class="clear"></div>
<div class="statistic chattyCommits">
<h3>Chatty Commits</h3>
<div class="header"><div class="name">Chatty Commits</div></div>
<table class="commitsList">
<% chatty_commits.each do |commit, count| %>
<tr>
<td><a href="/profile/<%= commit.author.user.id %>">
<img class="avatar" src="<%= commit.author.user.gravatar %>"/></a></td>
<td class="author">
<a href="/profile/<%= commit.author.user.id %>"
title="<%= commit.author.email %>"><%= commit.author.to_s[0..25] %></a></td>
<td class="commitId">
<a href="<%= commit.link %>" class="commitLink"><%= commit.id_abbrev %></a></td>
<td class="commitMessage">
<a href="<%= commit.link %>"><%= CGI::escapeHTML(commit.short_message) %></a>
</td>
<td class="count"><%= count %> comments</td>
<td class="commitDate">committed <%= commit.date.to_pretty %></td>
</tr>
<%= erb :_commit_line, :layout => false, :locals => { :commit => commit } %>
<% end %>
</table>
</div>
Expand Down

0 comments on commit 1d3a23d

Please sign in to comment.