forked from rubygems/rubygems.org
/
show.html.erb
63 lines (59 loc) · 2.47 KB
/
show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<% content_for :title do %>
<div id="avatar-frame">
<%= gravatar(64, "profile_gravatar", @user) %>
</div>
<div id="profile-info">
<h2 id="profile-name"><%= link_to @user.display_handle, profile_path(@user.display_id) %></h2>
<h3 id="profile-email"><%= mail_to @user.email, "(email)", :encode => "hex" %></h3>
</div>
<div id="downloads-ego">
<% if @user == current_user %>
<%= link_to "Edit Profile", edit_profile_path, :id => "edit-profile" %>
<% end %>
<% unless Rails.env.recovery? %>
<h5 id="downloads">Downloads (<%= @user.total_rubygems_count.to_s %> <%= "gem".pluralize(@user.total_rubygems_count) %>)</h5>
<div id="downloads_count">
<div><strong><%= number_with_delimiter(@user.today_downloads_count) %></strong> today</div>
<div><strong><%= number_with_delimiter(@user.total_downloads_count) %></strong> all time</div>
</div>
<% end %>
</div>
<% end %>
<% content_for :javascript do %>
<%= javascript_include_tag "raphael", "g.raphael", "g.bar" %>
<script type="text/javascript">
$(document).ready(function() {
var dates = <%= Rubygem.monthly_short_dates.to_json.html_safe %>;
<% @rubygems.each do |rubygem| %>
$.data(document.body, "graph-<%= rubygem.id %>", <%= rubygem.monthly_downloads.to_json.html_safe %>);
<% end %>
$(".profile-graph").each(function() {
var id = $(this).attr("id"),
r = Raphael(id),
fin = function () {
var currentDate = dates[Math.floor(this.bar.x / 22 - 1)]
this.flag = r.g.popup(this.bar.x, this.bar.y, currentDate + ": " + this.bar.value || "0").insertBefore(this);
},
fout = function () {
this.flag.animate({opacity: 0}, 300, function () {this.remove();});
};
r.g.barchart(15, 9, 655, 125,
[ $.data(document.body, id) ],
{ type: "soft", colors : { 0 : "rgb(200, 164, 164)" } }
).hover(fin, fout);
});
});
</script>
<% end %>
<div id="profile">
<div class="profile-list">
<ol>
<% if Rails.env.recovery? %>
<%= render :partial => 'rubygem', :collection => @rubygems + @extra_rubygems, :locals => {:graph => false} %>
<% else %>
<%= render :partial => 'rubygem', :collection => @rubygems, :locals => {:graph => true} %>
<%= render :partial => 'rubygem', :collection => @extra_rubygems, :locals => {:graph => false} %>
<% end %>
</ol>
</div>
</div>