forked from gollum/gollum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented basic timeline with the last 10 entries.
- Loading branch information
Showing
5 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<div id="wiki-wrapper" class="history"> | ||
<div id="head"> | ||
<h1>{{title}}</h1> | ||
{{>searchbar}} | ||
</div> | ||
<div id="wiki-history"> | ||
|
||
<table> | ||
<tbody> | ||
{{#commits}} | ||
<tr> | ||
<td class="author"> | ||
<a href="javascript:void(0)"> | ||
<img src="http://www.gravatar.com/avatar/{{gravatar}}?s=16" | ||
alt="avatar: {{author}}" class="mini-gravatar"> | ||
<span class="username">{{author}}</span> | ||
</a> | ||
</td> | ||
<td class="commit-name"> | ||
<span class="time-elapsed">{{date}}:</span> | ||
{{message}} | ||
[<a href="/{{page_link}}" title="View page">{{page_name}}</a>] | ||
</td> | ||
</tr> | ||
{{/commits}} | ||
|
||
</tbody> | ||
</table> | ||
|
||
</div> | ||
<div id="footer"> | ||
<ul class="actions"> | ||
<!-- only show this button if we have more than 20 revisions --> | ||
<li class="minibutton"><a href="#" | ||
class="action-back-to-top">Back to Top</a></li> | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module Precious | ||
module Views | ||
class Timeline < Layout | ||
attr_reader :page, :page_num | ||
|
||
def title | ||
"Timeline" | ||
end | ||
|
||
def commits | ||
commits = [] | ||
@entries.each do |v| | ||
file_name = v.show[0].b_path.split('/').pop() | ||
page_name = Gollum::Page.canonicalize_filename(file_name) | ||
page_link = Gollum::Page.cname(page_name) | ||
commits.push( | ||
{ :id => v.id, | ||
:id7 => v.id[0..6], | ||
:author => v.author.name, | ||
:message => v.message, | ||
:page_name=> page_name, | ||
:page_link=> page_link, | ||
:date => v.committed_date.strftime("%B %d, %Y"), | ||
:gravatar => Digest::MD5.hexdigest(v.author.email) } | ||
) | ||
end | ||
|
||
return commits | ||
end | ||
|
||
def previous_link | ||
label = "« Previous" | ||
if @page_num == 1 | ||
%(<span class="disabled">#{label}</span>) | ||
else | ||
%(<a href="/timeline?page=#{@page_num-1}" hotkey="h">#{label}</a>) | ||
end | ||
end | ||
|
||
def next_link | ||
label = "Next »" | ||
if @versions.size == Gollum::Page.per_page | ||
%(<a href="/timeline?page=#{@page_num+1}" hotkey="l">#{label}</a>) | ||
else | ||
%(<span class="disabled">#{label}</span>) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters