-
Notifications
You must be signed in to change notification settings - Fork 318
/
Copy pathindex.erb
60 lines (52 loc) · 2.51 KB
/
index.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
<p>
<small>If you did not need any credentials to get to this page</small>
<pre><code>gem sources -a <%= url "/" %></code></pre>
<small>If you needed some credentials to get to this page</small>
<pre><code>gem sources -a <%= url.to_s.gsub('://','://username:password@') %></code></pre>
<% if @allow_upload %>
<small>and then ...</small>
<pre><code>gem install geminabox<br />gem inabox [gemfile]</code></pre>
<% end %>
</p>
<% if @gems.any? %>
<% if @allow_upload %><a href="<%= url("/upload") %>">Upload Another Gem</a><% end %>
<div id="alpha_index"><%= ("a".."z").map{|i| @index_gems.include?(i) ? "<a href='#jump_#{i}'>#{i}</a>" : i }.join(" - ") %></div>
<ul class="gemlist">
<% @gems.by_name do |name, versions| %>
<li <%= %{id="jump_#{name[0..0].downcase}"} if @index_gems.delete(name[0..0].downcase) %> class="gem-version">
<h2><%= h(name) %> (<%= h(versions.count == 1 ? versions.first.number : "#{versions.oldest.number} - #{versions.newest.number}") %>)</h2>
<% versions.each.reverse_each.first(5).each do |version| %>
<p>
<code>gem install <%= h(version.name) %> <%= "--prerelease" if version.number.to_s.match(/[a-z]/i) %> -v "<%= h(version.number) %>"</code>
<% unless version.platform =~ /^ruby/i %>
<small class="platform"><%= h(version.platform) %></small>
<% end %>
</p>
<form class="delete-form" method="post" action="<%= h(url("/gems/#{version.gemfile_name}.gem")) %>">
<a class="download" href="<%= h(url("/gems/#{version.gemfile_name}.gem")) %>">download</a>
<% if @allow_delete %>
<input type="hidden" name="_method" value="DELETE" />
<button type="submit">delete</button>
<% end %>
</form>
<% end %>
<% if versions.count > 5 %>
<a href="<%= h(url("/gems/#{name}")) %>" id="more_link">Older versions...</a>
<% end %>
<div class="details">
<p>
<% newest_gem = versions.newest %>
<% if spec = spec_for(name, newest_gem.number, newest_gem.platform) %>
<%= h(spec.description) %>
<br/>
<span class="author">– <%= spec.authors.map do |author|
"<a href='#{href(spec.homepage)}'>#{h(author)}</a>"
end.join(', ') %></span>
<% end %>
</p>
</div>
</li>
<% end %>
</ul>
<% end %>
<% if @allow_upload %><a href="<%= url("/upload") %>">Upload Another Gem</a><% end %>