Showing 2 changed files with 82 additions and 51 deletions
+2 -8
templates/commits.html.ep
... ...
@@ -82,13 +82,9 @@
82 82
 <%
83 83
     $self->res->headers->content_type('application/atom+xml;charset=UTF-8');
84 84
     # Create atom feed
85
-    my $commit_title = $commit->{title};
86
-    $commit_title = Mojo::Util::xml_escape
87
-    
88 85
     my $alternate_url = url_with;
89 86
     my $alternate_url_path_parts = $alternate_url->path->parts;
90 87
     $alternate_url_path_parts->[-1] =~ s/\.atom$//;
91
-    
92 88
 #%>
93 89
 <?xml version="1.0" encoding="UTF-8" ?>
94 90
 <feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
... ...
@@ -99,18 +95,16 @@
99 95
   <updated><%= $commits->[0]->{updated} %></updated>
100 96
 
101 97
     % for my $commit (@$commits) {
102
-      % my $entry_alternate_url = url_for("/$user/$project/commit/$commit->{id}");
103
-      % my $author_url = url_for("/$user");
104 98
   <entry>
105 99
     <id>tag:gitprep,2008:Grit::Commit/<%= $commit->{id} %></id>
106
-    <link type="text/html" rel="alternate" href="<%= $entry_alternate_url->to_abs %>" />
100
+    <link type="text/html" rel="alternate" href="<%= url_for("/$user/$project/commit/$commit->{id}")->to_abs %>" />
107 101
     <title>
108 102
         <%= $commit->{title} %>
109 103
     </title>
110 104
     <updated><%= $commit->{updated} %></updated>
111 105
     <author>
112 106
       <name><%= $user %></name>
113
-      <uri><%= $author_url->to_abs %></uri>
107
+      <uri><%= url_for("/$user")->to_abs %></uri>
114 108
     </author>
115 109
     <content type="html">
116 110
       <%= "<pre style='white-space:pre-wrap;width:81ex'>$commit->{title}</pre>" %>
+80 -43
templates/user.html.ep
... ...
@@ -24,52 +24,89 @@
24 24
     $rep->{private} = $project->{private};
25 25
     push @$reps, $rep;
26 26
   }
27
-%>
27
+#%>
28
+% if ($render_atom_feed) {
29
+<%
30
+    $self->res->headers->content_type('application/atom+xml;charset=UTF-8');
31
+    my $alternate_url = url_with;
32
+    my $alternate_url_path_parts = $alternate_url->path->parts;
33
+    $alternate_url_path_parts->[-1] =~ s/\.atom$//;
34
+#%>
35
+<?xml version="1.0" encoding="UTF-8" ?>
36
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
37
+  <id>tag:gitprep,2008:/<%= $user %></id>
38
+  <link type="text/html" rel="alternate" href="<%= $alternate_url->to_abs %>"/>
39
+  <link type="application/atom+xml" rel="self" href="<%= url_with->to_abs %>"/>
40
+  <title>Recent Commits to <%= "$project:$rev" %></title>
41
+  <updated><%= $commits->[0]->{updated} %></updated>
42
+
43
+    % for my $commit (@$commits) {
44
+      % my $entry_alternate_url = url_for("/$user/$project/commit/$commit->{id}");
45
+      % my $author_url = url_for("/$user");
46
+  <entry>
47
+    <id>tag:gitprep,2008:Grit::Commit/<%= $commit->{id} %></id>
48
+    <link type="text/html" rel="alternate" href="<%= $entry_alternate_url->to_abs %>" />
49
+    <title>
50
+        <%= $commit->{title} %>
51
+    </title>
52
+    <updated><%= $commit->{updated} %></updated>
53
+    <author>
54
+      <name><%= $user %></name>
55
+      <uri><%= $author_url->to_abs %></uri>
56
+    </author>
57
+    <content type="html">
58
+      <%= "<pre style='white-space:pre-wrap;width:81ex'>$commit->{title}</pre>" %>
59
+    </content>
60
+  </entry>
61
+    % }
62
+</feed>
63
+% } else {
28 64
 
29
-% layout 'common', title => $user;
30
-  %= include '/include/header', title => 'Repositories';
65
+  % layout 'common', title => $user;
66
+    %= include '/include/header', title => 'Repositories';
31 67
 
32
-  <div class="container">
33
-    <div>
34
-      %= include '/include/message', message => flash('message');
35
-      
36
-      <ul class="breadcrumb" style="margin-top:10px">
37
-        <li><a href="<%= url_for('/') %>"><i class="icon-home"></i></a></li>
38
-        /
39
-        <li><a href="<%= url_for("/$user") %>"><%= $user %></a></li>
40
-      </ul>
68
+    <div class="container">
69
+      <div>
70
+        %= include '/include/message', message => flash('message');
71
+        
72
+        <ul class="breadcrumb" style="margin-top:10px">
73
+          <li><a href="<%= url_for('/') %>"><i class="icon-home"></i></a></li>
74
+          /
75
+          <li><a href="<%= url_for("/$user") %>"><%= $user %></a></li>
76
+        </ul>
41 77
 
42
-      <h3>Repositories</h3>
43
-      
44
-      <table class="table">
45
-        % for my $rep (sort { $a->{age} <=> $b->{age} } @$reps) {
46
-          % if (!$rep->{private} || $api->can_access_private_project($user, $rep->{name})) {
47
-            <tr>
48
-              % my $pname = $rep->{name};
49
-              <td>
50
-                <a href="<%= url_for("/$user/$pname") %>">
51
-                  <%= $rep->{name} %>
52
-                  % if ($rep->{private}) {
53
-                    <i class="icon icon-lock" style="margin-left:5px;margin-right:5px"></i>
78
+        <h3>Repositories</h3>
79
+        
80
+        <table class="table">
81
+          % for my $rep (sort { $a->{age} <=> $b->{age} } @$reps) {
82
+            % if (!$rep->{private} || $api->can_access_private_project($user, $rep->{name})) {
83
+              <tr>
84
+                % my $pname = $rep->{name};
85
+                <td>
86
+                  <a href="<%= url_for("/$user/$pname") %>">
87
+                    <%= $rep->{name} %>
88
+                    % if ($rep->{private}) {
89
+                      <i class="icon icon-lock" style="margin-left:5px;margin-right:5px"></i>
90
+                    % }
91
+                  </a>
92
+                </td>
93
+                <td>
94
+                  <%= $rep->{description} %>
95
+                </td>
96
+                % my $age = $rep->{age_string};
97
+                <td class="muted">
98
+                  % if ($rep->{none}) {
99
+                    <span style="color:red">Repository not exists</span>
100
+                    <a href="<%= "/$user/$rep->{name}/settings" %>" class="btn btn-mini">Settings</a>
101
+                  % } else {
102
+                    <%= $age ? "last updated $age" : 'new repository' %>
54 103
                   % }
55
-                </a>
56
-              </td>
57
-              <td>
58
-                <%= $rep->{description} %>
59
-              </td>
60
-              % my $age = $rep->{age_string};
61
-              <td class="muted">
62
-                % if ($rep->{none}) {
63
-                  <span style="color:red">Repository not exists</span>
64
-                  <a href="<%= "/$user/$rep->{name}/settings" %>" class="btn btn-mini">Settings</a>
65
-                % } else {
66
-                  <%= $age ? "last updated $age" : 'new repository' %>
67
-                % }
68
-              </td>
69
-            </tr>
104
+                </td>
105
+              </tr>
106
+            % }
70 107
           % }
71
-        % }
72
-      </table>
108
+        </table>
109
+      </div>
73 110
     </div>
74
-  </div>
75
-  %= include '/include/footer';
111
+    %= include '/include/footer';
112
+% }