ginatra 3.0.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -15
  3. data/.travis.yml +7 -6
  4. data/CONTRIBUTING.md +30 -0
  5. data/Gemfile +1 -9
  6. data/LICENSE.txt +30 -0
  7. data/README.md +63 -114
  8. data/Rakefile +10 -12
  9. data/bin/ginatra +79 -63
  10. data/config.ru +35 -3
  11. data/ginatra.gemspec +29 -18
  12. data/lib/ginatra.rb +161 -148
  13. data/lib/ginatra/config.rb +18 -121
  14. data/lib/ginatra/errors.rb +10 -0
  15. data/lib/ginatra/helpers.rb +154 -139
  16. data/lib/ginatra/repo.rb +67 -82
  17. data/lib/ginatra/repo_list.rb +25 -18
  18. data/lib/ginatra/repo_stats.rb +93 -0
  19. data/lib/ginatra/version.rb +4 -0
  20. data/lib/git/webby.rb +292 -0
  21. data/lib/git/webby/extensions.rb +10 -0
  22. data/lib/git/webby/http_backend.rb +177 -0
  23. data/lib/sinatra/partials.rb +1 -1
  24. data/public/css/application.css +6 -0
  25. data/public/css/custom.css +57 -0
  26. data/public/css/lib/bootstrap-responsive.min.css +9 -0
  27. data/public/css/lib/bootstrap.min.css +9 -0
  28. data/public/css/lib/highlight.css +209 -0
  29. data/public/img/glyphicons-halflings-white.png +0 -0
  30. data/public/img/glyphicons-halflings.png +0 -0
  31. data/public/img/spin.gif +0 -0
  32. data/public/js/application.js +5 -0
  33. data/public/js/custom.js +51 -0
  34. data/public/js/lib/bootstrap.min.js +6 -0
  35. data/public/js/lib/jquery.lazyload.min.js +2 -0
  36. data/public/js/lib/jquery.min.js +2 -0
  37. data/public/js/lib/jquery.pjax.js +739 -0
  38. data/repos/README.md +21 -8
  39. data/spec/ginatra/helpers_spec.rb +95 -0
  40. data/spec/ginatra/repo_list_spec.rb +66 -0
  41. data/spec/ginatra/repo_spec.rb +78 -0
  42. data/spec/ginatra/repo_stats_spec.rb +27 -0
  43. data/spec/ginatra_spec.rb +121 -0
  44. data/spec/spec_helper.rb +8 -17
  45. data/views/404.erb +18 -0
  46. data/views/500.erb +18 -0
  47. data/views/_footer.erb +7 -0
  48. data/views/_header.erb +12 -6
  49. data/views/_tree_nav.erb +53 -0
  50. data/views/atom.erb +32 -0
  51. data/views/blob.erb +27 -8
  52. data/views/commit.erb +95 -17
  53. data/views/empty_repo.erb +10 -0
  54. data/views/index.erb +27 -11
  55. data/views/layout.erb +16 -20
  56. data/views/log.erb +74 -54
  57. data/views/stats.erb +89 -0
  58. data/views/tree.erb +32 -20
  59. metadata +168 -94
  60. data/bin/ginatra-daemon +0 -87
  61. data/bin/ginatra-directory +0 -55
  62. data/bin/ginatra-server +0 -27
  63. data/bin/ginatra-setup +0 -28
  64. data/lib/ginatra/graph_commit.rb +0 -77
  65. data/public/img/add.png +0 -0
  66. data/public/img/diff.png +0 -0
  67. data/public/img/doc.png +0 -0
  68. data/public/img/rm.png +0 -0
  69. data/public/img/tree.png +0 -0
  70. data/public/src/branch-graph.js +0 -170
  71. data/public/src/colour.css +0 -86
  72. data/public/src/commit.css +0 -211
  73. data/public/src/ginatra.js +0 -7
  74. data/public/src/github.css +0 -129
  75. data/public/src/graph.css +0 -9
  76. data/public/src/highlight.pack.js +0 -1
  77. data/public/src/index.css +0 -92
  78. data/public/src/lists.css +0 -25
  79. data/public/src/raphael.js +0 -7
  80. data/public/src/reset.css +0 -49
  81. data/public/src/table.css +0 -33
  82. data/public/src/type.css +0 -30
  83. data/rackup.ru +0 -5
  84. data/spec/graph_commit_spec.rb +0 -54
  85. data/spec/repo_list_spec.rb +0 -84
  86. data/spec/repo_spec.rb +0 -61
  87. data/views/_actor_box.erb +0 -13
  88. data/views/_commit_info_box.erb +0 -27
  89. data/views/_tree_part.erb +0 -11
  90. data/views/atom.builder +0 -32
  91. data/views/graph.erb +0 -15
data/views/404.erb ADDED
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= title 'Error 404' %></title>
6
+ <link href="<%= prefix_url("assets/application.css") %>" rel="stylesheet">
7
+ </head>
8
+
9
+ <body>
10
+ <div class="container-fluid">
11
+ <div class="row-fluid text-info service-page">
12
+ <h1>404 <small>Page not found</small></h1>
13
+ <p class="lead">Sorry, this page is not available.</p>
14
+ <a href="/" class="btn btn-info">Back to home</a>
15
+ </div>
16
+ </div>
17
+ </body>
18
+ </html>
data/views/500.erb ADDED
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= title 'Error 500' %></title>
6
+ <link href="<%= prefix_url("assets/application.css") %>" rel="stylesheet">
7
+ </head>
8
+
9
+ <body>
10
+ <div class="container-fluid">
11
+ <div class="row-fluid text-error service-page">
12
+ <h1>500 <small>Internal Server Error</small></h1>
13
+ <p class="lead">Sorry, something went wrong.</p>
14
+ <a href="/" class="btn btn-danger">Back to home</a>
15
+ </div>
16
+ </div>
17
+ </body>
18
+ </html>
data/views/_footer.erb ADDED
@@ -0,0 +1,7 @@
1
+ <footer class="navbar navbar-fixed-bottom">
2
+ <nav class="navbar-inner">
3
+ <div class="container-fluid">
4
+ <p>Powered by <a href="https://github.com/narkoz/ginatra" target="_blank">Ginatra</a></p>
5
+ </div>
6
+ </nav>
7
+ </footer>
data/views/_header.erb CHANGED
@@ -1,6 +1,12 @@
1
- <h2>
2
- <a href='<%= prefix_url(repo.param) %>'><%= repo.name %></a>
3
- </h2>
4
- <div class='repo-info'>
5
- <%= repo.description.split("\n").first %>
6
- </div>
1
+ <div class="page-header">
2
+ <h1>
3
+ <%= empty_description_hint_for(repo) %>
4
+ <a href="<%= prefix_url(repo.param) %>"><%= repo.name %></a>
5
+ <small><%= repo.description.split("\n").first %></small>
6
+ </h1>
7
+ <% if Ginatra.config.git_clone_enabled? %>
8
+ <div id="js-clone-url" class="muted clone-hint">
9
+ <code>git clone <strong><%= url repo.param %></strong></code>
10
+ </div>
11
+ <% end %>
12
+ </div>
@@ -0,0 +1,53 @@
1
+ <% if @repo.branch_exists?(params[:tree]) %>
2
+ <div class="row-fluid">
3
+ <ul class="nav nav-pills pull-left">
4
+ <li>
5
+ <a href="<%= prefix_url(@repo.param) %>/<%= params[:tree] %>">Commits</a>
6
+ </li>
7
+ <li class="active">
8
+ <a href="<%= prefix_url(@repo.param) %>/tree/<%= params[:tree] %>">Source</a>
9
+ </li>
10
+ <li>
11
+ <a href="<%= prefix_url(@repo.param) %>/stats/<%= params[:tree] %>">Stats</a>
12
+ </li>
13
+ </ul>
14
+
15
+ <div class="btn-group pull-right">
16
+ <button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
17
+ <%= params[:tree] %> <span class="caret"></span>
18
+ </button>
19
+ <ul class="dropdown-menu">
20
+ <li class="dropdown-hint">Branches</li>
21
+ <li class="divider"></li>
22
+ <% @repo.branches.each do |branch| %>
23
+ <% if @blob %>
24
+ <li><a href="<%= prefix_url(@repo.param) %>/blob/<%= branch.name %>/<%= params[:splat].first %>"><%= branch.name %></a></li>
25
+ <% else %>
26
+ <li><a href="<%= prefix_url(@repo.param) %>/tree/<%= branch.name %><%= "/#{params[:splat].first}" unless params[:splat].nil? || params[:splat].empty? %>"><%= branch.name %></a></li>
27
+ <% end %>
28
+ <% end %>
29
+ </ul>
30
+ </div>
31
+ </div>
32
+ <% end %>
33
+
34
+ <% unless params[:splat].nil? or params[:splat].empty? %>
35
+ <% tree_nav = params[:splat].first.split('/') %>
36
+ <ul class="breadcrumb" id="js-tree-nav">
37
+ <li>
38
+ <a href="<%= prefix_url(@repo.param) %>/tree/<%= params[:tree] %>"><%= @repo.name %></a>
39
+ <span class="divider">/</span>
40
+ </li>
41
+
42
+ <% tree_nav.each_with_index do |path, index| %>
43
+ <% if index == tree_nav.size - 1 %>
44
+ <li class="active"><%= tree_nav.last %></li>
45
+ <% else %>
46
+ <li>
47
+ <a href="<%= prefix_url(@repo.param) %>/tree/<%= params[:tree] %>/<%= tree_nav[0..index].join('/') %>"><%= path %></a>
48
+ <span class="divider">/</span>
49
+ </li>
50
+ <% end %>
51
+ <% end %>
52
+ </ul>
53
+ <% end %>
data/views/atom.erb ADDED
@@ -0,0 +1,32 @@
1
+ <%
2
+ base_url = url prefix_url("#{@repo.param}")
3
+
4
+ if params[:ref]
5
+ url = "#{base_url}/#{params[:ref]}"
6
+ name = "#{@repo.name}: #{params[:ref]}"
7
+ else
8
+ url = base_url
9
+ name = "#{@repo.name}: master"
10
+ end
11
+ %><?xml version="1.0" encoding="utf-8"?>
12
+ <feed xmlns="http://www.w3.org/2005/Atom">
13
+ <id><%= url %></id>
14
+ <title>Commits to <%= name %></title>
15
+ <subtitle><%= h(@repo.description) %></subtitle>
16
+ <link href="<%= url %>"/>
17
+ <link rel="self" href="<%= url %>.atom"/>
18
+ <updated><%= @commits.first ? rfc_date(@commits.first.committer[:time]) : rfc_date(Time.now.utc) %></updated>
19
+ <% @commits.each do |commit| %>
20
+ <entry>
21
+ <id><%= "#{base_url}/commit/#{commit.oid[0..6]}" %></id>
22
+ <title><%= "Commit #{commit.oid[0..6]} to #{@repo.name}" %></title>
23
+ <content><%= h(simple_format commit.message) %></content>
24
+ <link href="<%= "#{base_url}/commit/#{commit.oid[0..6]}" %>"/>
25
+ <updated><%= rfc_date(commit.committer[:time]) %></updated>
26
+ <author>
27
+ <name><%= commit.author[:name] %></name>
28
+ <email><%= commit.author[:email] %></email>
29
+ </author>
30
+ </entry>
31
+ <% end %>
32
+ </feed>
data/views/blob.erb CHANGED
@@ -1,9 +1,28 @@
1
- <%= partial(:header, :locals => {:repo => @repo}) %>
2
- <h3>Blob: <%= params[:splat].first %></h3>
3
- <div class="active">
4
- <div class="blob">
5
- <h4><img src="<%= prefix_url("img/doc.png") %>" /><%= @blob.name %></h4>
6
- <pre><code><%= @blob.data %></code></pre>
7
- </div>
8
- <div class="clearfix">&nbsp;</div>
1
+ <% title @blob[:name], headline: @repo.name %>
2
+
3
+ <%= partial :header, locals: { repo: @repo } %>
4
+ <%= partial :tree_nav %>
5
+
6
+ <% raw_blob_url = "#{prefix_url(@repo.param)}/raw/#{params[:tree]}/#{params[:splat].first}" %>
7
+
8
+ <div class="row-fluid">
9
+ <p class="pull-left"><%= file_icon @blob[:filemode] %> <%= @blob[:name] %></p>
10
+ <p class="pull-right"><a href="<%= raw_blob_url %>">Raw</a></p>
9
11
  </div>
12
+
13
+ <% blob = @repo.find_blob @blob[:oid] %>
14
+
15
+ <% if blob.binary? %>
16
+ <% if %(gif png jpg jpeg).include? File.extname(@blob[:name])[1..-1].downcase %>
17
+ <a href="<%= raw_blob_url %>">
18
+ <img class="blob-image" src="<%= raw_blob_url %>" alt="<%= @blob[:name] %>">
19
+ </a>
20
+ <% else %>
21
+ <p>Binary file</p>
22
+ <p><span class="icon-download"></span> <a href="<%= raw_blob_url %>">Download</a></p>
23
+ <% end %>
24
+ <% else %>
25
+ <div class="source-wrapper highlight">
26
+ <%= highlight_source blob.content, @blob[:name] %>
27
+ </div>
28
+ <% end %>
data/views/commit.erb CHANGED
@@ -1,20 +1,98 @@
1
- <%= partial(:header, :locals => {:repo => @repo}) %>
2
- <h3>Commit: <%= @commit.id %><%= commit_refs(@commit, @repo.param) %> <%= patch_link(@commit, @repo.param) %></h3>
3
- <div class="active">
4
- <div class='single-commit' id='commit'>
5
- <%= partial(:commit_info_box,
6
- :locals => { :repo => @repo,
7
- :commit => @commit }) %>
8
- <%= actor_boxes @commit %>
9
- <div id="message"><%= simple_format(h(@commit.message)) %></div>
10
- <%= file_listing(@commit) %>
11
- <div id="files">
12
- <% count = 0 %>
13
- <% @commit.diffs.select { |d| !d.deleted_file && !d.new_file }.each do |diff| %>
14
- <% count += 1 %>
15
- <h4><img src="<%= prefix_url("img/doc.png") %>" /><a name='file_<%= count %>'><code><%= diff.b_path %></code></a></h4>
16
- <pre><code class="diff"><%= diff.diff %></code></pre>
17
- <% end %>
1
+ <% title @repo.name, headline: "Commit #{@commit.oid[0..6]}" %>
2
+ <%= partial :header, locals: { repo: @repo } %>
3
+
4
+ <div class="info-box">
5
+ <div class="row-fluid">
6
+ <div class="span5">
7
+ <%= simple_format h(@commit.message) %>
8
+
9
+ <div class="author-box">
10
+ <%= gravatar_image_tag @commit.author[:email], class: 'img-rounded', alt: @commit.author[:name] %>
11
+ <strong data-toggle="tooltip" data-placement="bottom" title="<%= @commit.author[:email] %>"><%= @commit.author[:name] %></strong>
12
+ authored at <%= time_tag @commit.author[:time] %>
13
+
14
+ <% unless @commit.committer[:name] == @commit.author[:name] %>
15
+ <div class="author-box">
16
+ <%= gravatar_image_tag @commit.committer[:email], class: 'img-rounded', alt: @commit.committer[:name] %>
17
+ <strong data-toggle="tooltip" data-placement="bottom" title="<%= @commit.committer[:email] %>"><%= @commit.committer[:name] %></strong>
18
+ committed at <%= time_tag @commit.committer[:time] %>
19
+ </div>
20
+ <% end %>
21
+ </div>
22
+
23
+ <br>
24
+ <p>
25
+ as seen in:
26
+ <% @repo.branches_with(@commit.oid).each do |branch| %>
27
+ <a href="<%= h prefix_url(@repo.param) %>/tree/<%= h branch.name %>">
28
+ <%= h branch.name %>
29
+ </a>
30
+ <% end %>
31
+ </p>
18
32
  </div>
33
+ <div class="span7">
34
+ <div class="row-fluid">
35
+ <div class="span1">
36
+ <p><strong>commit:</strong></p>
37
+ <p><strong>tree:</strong></p>
38
+ <% @commit.parents.size.times do %>
39
+ <p><strong>parent:</strong></p>
40
+ <% end %>
41
+ </div>
42
+ <div class="span3">
43
+ <p>
44
+ <a href="<%= prefix_url(@repo.param) %>/commit/<%= @commit.oid %>">
45
+ <%= @commit.oid %>
46
+ </a>
47
+ </p>
48
+
49
+ <p>
50
+ <a href="<%= prefix_url(@repo.param) %>/tree/<%= @commit.tree.oid %>">
51
+ <%= @commit.tree.oid %>
52
+ </a>
53
+ </p>
54
+
55
+ <% @commit.parents.each do |parent| %>
56
+ <p>
57
+ <a href="<%= prefix_url(@repo.param) %>/commit/<%= parent.oid %>">
58
+ <%= parent.oid %>
59
+ </a>
60
+ </p>
61
+ <% end %>
62
+
63
+ <p><span class="icon-download"></span> <%= patch_link @commit, @repo.param %></p>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+
70
+ <div id="diff">
71
+ <% diff = @commit.parents.first.diff(@commit) %>
72
+
73
+ <p>
74
+ <button class="btn btn-primary"><%= diff.deltas.size %> changed files</button>
75
+ <button class="btn" type="button" id="js-toggle-file-listing">Show file listing</button>
76
+ </p>
77
+
78
+ <div class="hide" id="js-file-listing">
79
+ <%= file_listing diff %>
19
80
  </div>
81
+
82
+ <% diff.patches.each_with_index do |patch, index| %>
83
+ <div class="row-fluid">
84
+ <p class="pull-left">
85
+ <span class="icon-file"></span> <a id='file-<%= index + 1 %>'><%= patch.delta.new_file[:path] %></a>
86
+ </p>
87
+ <p class="pull-right">
88
+ <% unless patch.delta.deleted? %>
89
+ <a href="<%= prefix_url(@repo.param) %>/blob/<%= @commit.tree.oid %>/<%= patch.delta.new_file[:path] %>">view file</a>
90
+ <% end %>
91
+ </p>
92
+ </div>
93
+
94
+ <% patch.hunks.each do |hunk| %>
95
+ <%= highlight_diff hunk %>
96
+ <% end %>
97
+ <% end %>
20
98
  </div>
@@ -0,0 +1,10 @@
1
+ <% title @repo.name, headline: 'Empty repository' %>
2
+ <%= partial :header, locals: { repo: @repo } %>
3
+
4
+ <div class="row-fluid">
5
+ <div class="span12">
6
+ <div class="row-fluid">
7
+ Repository is empty.
8
+ </div>
9
+ </div>
10
+ </div>
data/views/index.erb CHANGED
@@ -1,12 +1,28 @@
1
- <h3>Repositories</h3>
2
- <div class="active repo-list">
3
- <div class="commit-info">
4
- <%=h Ginatra::Config.description %>
5
- </div>
6
- <dl>
7
- <% Ginatra::RepoList.list.each do |repo| %>
8
- <dt><a href="<%= prefix_url(repo.param) %>"><%= repo.name %></a></dt>
9
- <dd><%=h repo.description %></dd>
10
- <% end %>
11
- </dl>
1
+ <div class="page-header">
2
+ <h1><%= title 'Repositories' %> <small><%= h Ginatra.config.description %></small></h1>
3
+ <% if Ginatra.config.git_clone_enabled? && @repositories.any? %>
4
+ <div class="muted clone-hint">
5
+ To clone one of these repositories, install git, and run:
6
+ git clone <%= url %><strong>repo-name</strong>
7
+ </div>
8
+ <% end %>
12
9
  </div>
10
+
11
+ <% if @repositories.size > 10 %>
12
+ <div class="row-fluid filter">
13
+ <input type="text" class="span12 js-filter-query" placeholder="Filter...">
14
+ </div>
15
+ <% end %>
16
+
17
+ <ul class="nav nav-tabs nav-stacked js-repolist">
18
+ <% @repositories.each do |repo| %>
19
+ <li>
20
+ <a href="<%= prefix_url(repo.param) %>">
21
+ <h2>
22
+ <%= empty_description_hint_for(repo) %>
23
+ <%= repo.name %> <small><%= h repo.description %></small>
24
+ </h2>
25
+ </a>
26
+ </li>
27
+ <% end %>
28
+ </ul>
data/views/layout.erb CHANGED
@@ -1,28 +1,24 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html
1
+ <!DOCTYPE html>
2
+ <html>
4
3
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>Ginatra</title>
7
- <link rel="stylesheet" href="<%= prefix_url("src/index.css") %>" type="text/css" media="screen" />
8
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
9
- <script src="<%= prefix_url("src/ginatra.js") %>" type="text/javascript"></script>
10
- <script type="text/javascript" src="<%= prefix_url("src/highlight.pack.js") %>"></script>
11
- <script type="text/javascript">
12
- hljs.initHighlightingOnLoad();
13
- </script>
14
- <link rel="stylesheet" href="<%= prefix_url("src/github.css") %>" type="text/css" media="screen" />
4
+ <meta charset="utf-8">
5
+ <title><%= title(sitename: 'Ginatra') %></title>
6
+ <link href="<%= prefix_url("assets/application.css") %>" rel="stylesheet">
7
+ <% if @repo %>
8
+ <link href="<%= atom_feed_url @repo.name, params[:ref] %>" title="Commits to <%= @repo.name %><%= ": #{params[:ref]}" if params[:ref] %>" type="application/atom+xml" rel="alternate">
9
+ <% end %>
15
10
  </head>
16
11
  <body>
17
- <div id="content">
18
- <div id="inner">
12
+ <div class="container-fluid push">
13
+ <div class="well header">
19
14
  <h1><a href="<%= prefix_url %>">Ginatra</a></h1>
20
- <%= yield %>
21
15
  </div>
22
- <div id="footer-spacer">&nbsp;</div>
23
- </div>
24
- <div id="footer">
25
- Ginatra &mdash; &copy; 2009 Samuel Elliott &mdash; <a href="http://www.opensource.org/licenses/mit-license.php">MIT Licence</a>
16
+
17
+ <%= yield %>
26
18
  </div>
19
+
20
+ <%= partial :footer %>
21
+
22
+ <script src="<%= prefix_url("assets/application.js") %>"></script>
27
23
  </body>
28
24
  </html>
data/views/log.erb CHANGED
@@ -1,64 +1,84 @@
1
- <%= partial(:header, :locals => {:repo => @repo}) %>
2
- <h3>Commits<% if params[:ref] %>: <%= params[:ref] %><% end %> <%= atom_feed_link(@repo.param, params[:ref]) %> <a class="branch-graph" href="<%=h prefix_url(@repo.param) %>/graph">Branch graph</a></h3>
3
- <div class="active">
4
- <% if @previous_commits %>
5
- <a href='<%= prefix_url(params[:repo]) %>/<%= params[:ref] %>/<%= params[:page] - 1 %>'>Previous</a>
6
- <% end %>
1
+ <% title @repo.name, headline: 'Commits' %>
2
+ <%= partial :header, locals: { repo: @repo } %>
7
3
 
8
- <% if @separator %>
9
- |
10
- <% end %>
11
-
12
- <% if @next_commits %>
13
- <a href='<%= prefix_url(params[:repo]) %>/<%= params[:ref] %>/<%= params[:page] + 1 %>'>Next</a>
14
- <% end %>
15
- <div class='list'>
16
- <div id='heads'>
17
- <h3>Heads</h3>
18
- <ul>
19
- <% @repo.heads.each do |head| %>
4
+ <div class="row-fluid">
5
+ <div class="span12">
6
+ <div class="row-fluid">
7
+ <div class="span8">
8
+ <ul class="nav nav-pills">
9
+ <li class="active">
10
+ <a href="<%= prefix_url(@repo.param) %>/<%= params[:ref] %>">Commits</a>
11
+ </li>
20
12
  <li>
21
- <a href="<%=h prefix_url(@repo.param) %>/<%=h head.name %>">
22
- <%=h head.name %>
23
- </a>
13
+ <a href="<%= prefix_url(@repo.param) %>/tree/<%= params[:ref] %>">Source</a>
24
14
  </li>
25
- <% end %>
26
- </ul>
27
- </div>
28
-
29
- <div id='tags'>
30
- <h3>Tags</h3>
31
- <% unless @repo.tags.empty? %>
32
- <ul>
33
- <% @repo.tags.each do |tag| %>
34
- <li>
35
- <a href="<%=h prefix_url(@repo.param) %>/commit/<%=h tag.name %>">
36
- <%=h tag.name %>
15
+ <li>
16
+ <a href="<%= prefix_url(@repo.param) %>/stats/<%= params[:ref] %>">Stats</a>
17
+ </li>
18
+ </ul>
19
+
20
+ <table class="table table-striped table-bordered table-hover">
21
+ <thead>
22
+ <tr>
23
+ <th>Author</th>
24
+ <th>Commit message</th>
25
+ <th>Date</th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ <% @commits.each do |commit| %>
30
+ <% url = prefix_url("#{@repo.param}/commit/#{commit.oid}") %>
31
+ <tr class="js-nav" data-href="<%= url %>">
32
+ <td><%= gravatar_image_tag commit.author[:email], class: 'img-rounded', alt: commit.author[:name], lazy: true %> <%= commit.author[:name] %></td>
33
+ <td><a href="<%= url %>"><%= truncate(h(commit.message), { length: 140, separator: ' ' }) %></a></td>
34
+ <td><%= time_tag(commit.committer[:time]) %></td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
39
+
40
+ <ul class="pager">
41
+ <% if @previous_commits %>
42
+ <li class="previous">
43
+ <a href='<%= prefix_url(params[:repo]) %>/<%= params[:ref] %>/page/<%= params[:page] - 1 %>'>&larr; Previous</a>
44
+ </li>
45
+ <% end %>
46
+
47
+ <% if @next_commits %>
48
+ <li class="next">
49
+ <a href='<%= prefix_url(params[:repo]) %>/<%= params[:ref] %>/page/<%= params[:page] + 1 %>'>Next &rarr;</a>
50
+ </li>
51
+ <% end %>
52
+ </ul>
53
+ </div>
54
+
55
+ <div class="span4">
56
+ <ul class="nav nav-list">
57
+ <li class="nav-header">Branches (<%= @repo.branches.size %>)</li>
58
+ <% @repo.branches.each do |branch| %>
59
+ <li class="<%= 'active' if branch.name == params[:ref] %>">
60
+ <a href="<%= h prefix_url(@repo.param) %>/<%= h branch.name %>">
61
+ <%= h branch.name %>
37
62
  </a>
38
63
  </li>
39
64
  <% end %>
65
+
66
+ <li class="divider"></li>
67
+
68
+ <li class="nav-header">Tags (<%= @repo.tags.count %>)</li>
69
+ <% if @repo.tags.any? %>
70
+ <% @repo.tags.each_name do |tag| %>
71
+ <li>
72
+ <a href="<%= h prefix_url(@repo.param) %>/tag/<%= h tag %>">
73
+ <%= h tag %>
74
+ </a>
75
+ </li>
76
+ <% end %>
77
+ <% else %>
78
+ <li>No tags</li>
79
+ <% end %>
40
80
  </ul>
41
- <% else %>
42
- <p>No tags</p>
43
- <% end %>
44
- </div>
45
- </div>
46
- <div id='commit-log'>
47
- <% @commits.each do |commit| %>
48
- <% url = prefix_url("#{@repo.param}/commit/#{commit.id_abbrev}") %>
49
- <div id='commit_<%= commit.id_abbrev %>' class='commit' onclick="location.href='<%= url %>'">
50
- <div class='right'>
51
- <span class='id'>
52
- <code><a href="<%= url %>"><%= commit.id %></a></code>
53
- </span>
54
- <span class='refs'><%= commit_refs(commit, @repo.param) %></span>
55
- </div>
56
- <span class='date'><%= nicetime(commit.committed_date) %></span><br>
57
-
58
- <span class='message'><%= truncate(h(commit.short_message), { :length => 140, :separator => ' '}) %></span><br>
59
- <span class='author'><%= commit.author.name %> <small>(author)</small></span>
60
81
  </div>
61
- <% end %>
82
+ </div>
62
83
  </div>
63
- <div class="clearfix">&nbsp;</div>
64
84
  </div>