Showing 1 changed files with 105 additions and 109 deletions
+105 -109
templates/commits.html.ep
... ...
@@ -47,8 +47,6 @@
47 47
   
48 48
   # Render atom xml feed
49 49
   if ($render_atom_feed) {
50
-    my $url = url_with->to_abs;
51
-    
52 50
     # Add updated date time
53 51
     for my $commit (@$commits) {
54 52
       my $committer_epoch = $commit->{committer_epoch};
... ...
@@ -71,130 +69,128 @@
71 69
       
72 70
       $commit->{updated} = $updated;
73 71
     }
74
-    
75
-    my $xml = <<"EOS";
72
+  }
73
+#%>
74
+% if ($render_atom_feed) {
75
+<%
76
+    $self->res->headers->content_type('application/atom+xml');
77
+    # Create atom feed
78
+    my $commit_title = $commit->{title};
79
+    $commit_title = Mojo::Util::xml_escape
80
+    my $url = url_with->to_abs;
81
+    my $url_no_atom = $url;
82
+    $url_no_atom =~ s/\.atom$//;
83
+#%>
76 84
 <?xml version="1.0" encoding="UTF-8"?>
77 85
 <feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
78 86
   <id>tag:gitprep,2008:/$user/$project/commits/$rev_file</id>
79
-  <link type="text/html" rel="alternate" href="$url"/>
80
-  <link type="application/atom+xml" rel="self" href="$url"/>
81
-  <title>Recent Commits to $project:$rev</title>
82
-  <updated>$commits->[0]->{updated}</updated>
83
-
84
-EOS
87
+  <link type="text/html" rel="alternate" href="<%= $url_no_atom %>"/>
88
+  <link type="application/atom+xml" rel="self" href="<%= $url %>"/>
89
+  <title>Recent Commits to <%= "$project:$rev" %></title>
90
+  <updated><%= $commits->[0]->{updated} %></updated>
85 91
 
86
-    for my $commit (reverse @$commits) {
87
-      my $author_uri = url_for->base->to_abs . "/$user";
88
-      my $link_href = url_for->base->to_abs . "/$user/$project/commit/$commit->{id}";
89
-      $xml .= <<"EOS";
92
+    % for my $commit (@$commits) {
93
+      % my $author_uri = url_for->base->to_abs . "/$user";
94
+      % my $link_href = url_for->base->to_abs . "/$user/$project/commit/$commit->{id}";
90 95
   <entry>
91
-    <id>tag:gitprep,2008:Grit::Commit/$commit->{id}</id>
92
-    <link type="text/html" rel="alternate" href="$link_href"/>
96
+    <id>tag:gitprep,2008:Grit::Commit/<%= $commit->{id} %></id>
97
+    <link type="text/html" rel="alternate" href="<%= $link_href %>"/>
93 98
     <title>
94
-        $commit->{title}
99
+        <%= $commit->{title} %>
95 100
     </title>
96
-    <updated>$commit->{updated}</updated>
101
+    <updated><%= $commit->{updated} %></updated>
97 102
     <author>
98
-      <name>$user</name>
99
-      <uri>$author_uri</uri>
103
+      <name><%= $user %></name>
104
+      <uri><%= $author_uri %></uri>
100 105
     </author>
101 106
     <content type="html">
102
-      &lt;pre style='white-space:pre-wrap;width:81ex'>$commit->{title}&lt;/pre>
107
+      <%= "<pre style='white-space:pre-wrap;width:81ex'>$commit->{title}</pre>" %>
103 108
     </content>
104 109
   </entry>
105
-EOS
106
-    }
107
-
108
-    $xml .= <<"EOS";
110
+    % }
109 111
 </feed>
110
-EOS
112
+% } else {
113
+  % layout 'common', title => "Commit History \x{30fb} $user/$project";
111 114
     
112
-    $self->res->headers->content_type('application/atom+xml');
113
-    $self->render(text => $xml);
114
-    return;
115
-  }
116
-%>
117
-
118
-% layout 'common', title => "Commit History \x{30fb} $user/$project";
119
-  
120
-  %= include '/include/header';
115
+    %= include '/include/header';
121 116
 
122
-  <div class="container">
123
-    %= include '/include/project_header';
124
-    %= include '/include/code_menu', display => 'commits';
125
-        
126
-    <div style="margin-top:20px;margin-bottom:15px">
127
-      % if (defined $file && length $file) {
128
-        %= include '/include/page_path', type => 'blob', Path => $file, operation => 'commits', prefix => 'History for';
129
-      % } else {
130
-        <div style="font-size:18px">
131
-          <a class="ubar" href="<%= url_for("/$user/$project") %>">
132
-            <%= $project %>
133
-          </a>
134
-          /
135
-          <span class="muted">Commit History</span>
136
-        </div>
137
-      % }
138
-    </div>
139
-    
140
-    % for my $date (reverse sort keys %$commits_date) {
141
-      <div style="margin-bottom:20px">
142
-        % my $commits = $commits_date->{$date};
143
-        
144
-        <div class="bk-blue-light border-blue radius-top" style="padding:5px 8px;color:#3a505b">
145
-          <b><%= $date %></b>
146
-        </div>
147
-        % my $num = 0;
148
-        % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) {
149
-          <div class="border-gray" style="font-size:14px;padding-bottom:0;border-top:none;border-bottom:none;padding:5px 5px 1px 5px">
150
-            <div class="row">
151
-              <div class="span8">
152
-                <a class="font-black" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
153
-                  <b><%= $commit->{title_short} %></b>
154
-                </a>
155
-              </div>
156
-              <div class="text-right">
157
-                <a class="btn" style="width:90px;padding:0px 10px;color:#3a505b;font-size:12px" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
158
-                  <%= substr($commit->{id}, 0, 10) %>
159
-                  <i class="icon-circle-arrow-right"></i>
160
-                </a>
161
-              </div>
162
-            </div>
117
+    <div class="container">
118
+      %= include '/include/project_header';
119
+      %= include '/include/code_menu', display => 'commits';
120
+          
121
+      <div style="margin-top:20px;margin-bottom:15px">
122
+        % if (defined $file && length $file) {
123
+          %= include '/include/page_path', type => 'blob', Path => $file, operation => 'commits', prefix => 'History for';
124
+        % } else {
125
+          <div style="font-size:18px">
126
+            <a class="ubar" href="<%= url_for("/$user/$project") %>">
127
+              <%= $project %>
128
+            </a>
129
+            /
130
+            <span class="muted">Commit History</span>
163 131
           </div>
164
-          <div class="border-blue <%= $num eq @$commits - 1 ? 'radius-bottom' : '' %>" style="font-size:12px;border-top:none; padding:1px 5px 5px 5px">
165
-            <div class="row">
166
-              <div class="span8">
167
-                <span title="<%= $commit->{author_email} %>"><%= $commit->{author_name} %></span> <span class="muted" title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string} %></span>
132
+        % }
133
+      </div>
134
+      
135
+      % for my $date (reverse sort keys %$commits_date) {
136
+        <div style="margin-bottom:20px">
137
+          % my $commits = $commits_date->{$date};
138
+          
139
+          <div class="bk-blue-light border-blue radius-top" style="padding:5px 8px;color:#3a505b">
140
+            <b><%= $date %></b>
141
+          </div>
142
+          % my $num = 0;
143
+          % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) {
144
+            <div class="border-gray" style="font-size:14px;padding-bottom:0;border-top:none;border-bottom:none;padding:5px 5px 1px 5px">
145
+              <div class="row">
146
+                <div class="span8">
147
+                  <a class="font-black" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
148
+                    <b><%= $commit->{title_short} %></b>
149
+                  </a>
150
+                </div>
151
+                <div class="text-right">
152
+                  <a class="btn" style="width:90px;padding:0px 10px;color:#3a505b;font-size:12px" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
153
+                    <%= substr($commit->{id}, 0, 10) %>
154
+                    <i class="icon-circle-arrow-right"></i>
155
+                  </a>
156
+                </div>
168 157
               </div>
169
-              <div class="text-right">
170
-                <a class="muted" style="padding-right:18px;font-weight:bold" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">                  Browse code
171
-                </a>
158
+            </div>
159
+            <div class="border-blue <%= $num eq @$commits - 1 ? 'radius-bottom' : '' %>" style="font-size:12px;border-top:none; padding:1px 5px 5px 5px">
160
+              <div class="row">
161
+                <div class="span8">
162
+                  <span title="<%= $commit->{author_email} %>"><%= $commit->{author_name} %></span> <span class="muted" title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string} %></span>
163
+                </div>
164
+                <div class="text-right">
165
+                  <a class="muted" style="padding-right:18px;font-weight:bold" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">                  Browse code
166
+                  </a>
167
+                </div>
172 168
               </div>
173 169
             </div>
174
-          </div>
175
-          % $num++;
176
-        % }
177
-      </div>
178
-    % }
179
-
180
-    <ul class="pager" style="text-align:left">
181
-      % if ($page == 0) {
182
-        <li class="disabled">&laquo; Newer</li>
183
-      % } else {
184
-        % my $newer_page = $page - 1;
185
-        <li class="disable">
186
-          <a href="<%= url_for("/$user/$project/commits/$rev?page=$newer_page") %>">&laquo; Newer</a>
187
-        </li>
188
-      % }
189
-      % if ($commits_count < $page_count) {
190
-        <li class="disabled">Older &raquo;</li>
191
-      % } else {
192
-        % my $older_page = $page + 1;
193
-        <li>
194
-          <a href="<%= url_for("/$user/$project/commits/$rev?page=$older_page") %>">Older &raquo;</a>
195
-        </li>
170
+            % $num++;
171
+          % }
172
+        </div>
196 173
       % }
197
-    </ul>
198
-  </div>
199
-  
200
-  %= include '/include/footer';
174
+
175
+      <ul class="pager" style="text-align:left">
176
+        % if ($page == 0) {
177
+          <li class="disabled">&laquo; Newer</li>
178
+        % } else {
179
+          % my $newer_page = $page - 1;
180
+          <li class="disable">
181
+            <a href="<%= url_for("/$user/$project/commits/$rev?page=$newer_page") %>">&laquo; Newer</a>
182
+          </li>
183
+        % }
184
+        % if ($commits_count < $page_count) {
185
+          <li class="disabled">Older &raquo;</li>
186
+        % } else {
187
+          % my $older_page = $page + 1;
188
+          <li>
189
+            <a href="<%= url_for("/$user/$project/commits/$rev?page=$older_page") %>">Older &raquo;</a>
190
+          </li>
191
+        % }
192
+      </ul>
193
+    </div>
194
+    
195
+    %= include '/include/footer';
196
+% }