GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of sr/git-wiki
Description: A wiki engine that uses a Git repository as its data store.
Homepage: http://atonie.org/2008/02/git-wiki
Clone URL: git://github.com/al3x/git-wiki.git
display page commit times as cacheable, client-side 
time_ago_in_words-style strings
Alex Payne (author)
Sun Feb 24 14:20:15 -0800 2008
commit  67c2152338a6555ff370c2040592c46f26566975
tree    589b9f8c18782d544229f79f3d3266080fe944e2
parent  c68ded5f31e086e58965017c5c680535b7dedd53
...
95
96
97
98
99
100
101
 
102
 
 
103
104
105
...
95
96
97
 
 
 
 
98
99
100
101
102
103
104
0
@@ -95,11 +95,10 @@ ul {
0
 
0
 .sub_nav { float: left; }
0
 
0
-.details {
0
- text-align: right;
0
- font-size: 75%;
0
- margin: 2em 0 0 0;
0
+.sub_nav .details {
0
   color: #888;
0
+ font-size: .85em;
0
+ margin-left: 0.3em;
0
 }
0
 
0
 /* ids */
...
3
4
5
 
 
 
 
 
 
6
7
...
3
4
5
6
7
8
9
10
11
12
13
0
@@ -3,4 +3,10 @@ class String
0
     self.gsub!(/\b((?:[A-Z]\w+){2,})/) { |m| "<a href=\"/e/#{m}\">#{m}</a>" }
0
     self
0
   end
0
+end
0
+
0
+class Time
0
+ def for_time_ago_in_words
0
+ "#{(self.to_i * 1000)}"
0
+ end
0
 end
0
\ No newline at end of file
...
34
35
36
 
37
38
39
...
34
35
36
37
38
39
40
0
@@ -34,6 +34,7 @@ end
0
 get('/') { redirect '/' + HOMEPAGE }
0
 get('/_style.css') { File.read(File.join(File.dirname(__FILE__), 'css', 'style.css')) }
0
 get('/_code.css') { File.read(File.join(File.dirname(__FILE__), 'css', "#{UV_THEME}.css")) }
0
+get('/_app.js') { File.read(File.join(File.dirname(__FILE__), 'javascripts', "application.js")) }
0
 
0
 get '/_list' do
0
   if $repo.commits.empty?
...
1
2
 
3
4
5
6
 
7
8
9
...
1
2
3
4
5
6
 
7
8
9
10
0
@@ -1,9 +1,10 @@
0
 <html>
0
   <head>
0
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
0
     <title><%= @title %></title>
0
     <link rel="stylesheet" href="/_style.css" type="text/css" media="screen" />
0
     <link rel="stylesheet" href="/_code.css" type="text/css" media="screen" />
0
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
0
+ <script language="javascript" type="text/javascript" src="/_app.js"></script>
0
   </head>
0
   <body>
0
     <div id="container">
...
12
13
14
 
 
 
 
 
 
15
16
17
18
19
20
21
 
 
 
22
...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
27
28
29
30
0
@@ -12,11 +12,19 @@
0
   <% if @page.previous_commit %>
0
     &bull; <a href="/h/<%= @page.name %>/<%= @page.previous_commit %>" class="nav_link">older</a>
0
   <% end %>
0
+
0
+ <div class="sub_nav details">
0
+ <script type="text/javascript">
0
+ document.write(time_ago_in_words(<%= @page.updated_at.for_time_ago_in_words %>) + ' ago');
0
+ </script>
0
+ </div>
0
 </div>
0
 
0
 <div class="content">
0
   <%= @page.body %>
0
 </div>
0
 
0
-<p class="details"><%= @page.updated_at %></p>
0
+<p class="details">
0
+
0
+</p>
0
 

Comments

    No one has commented yet.