changeset 18046:40374059d227

hgwebdir: do not show RSS and Atom links for plain directories Up until now the templates that show RSS and Atom feeds on the "repository lists" (i.e. gitweb and monoblue) showed them for all entries, including regular folders. Clicking on those "folder RSS" links would result in an error page being shown. This patch hides those links for regular folders.
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Tue, 27 Nov 2012 22:24:02 +0100
parents add2f9ddcfb5
children 9196638b08ce
files mercurial/hgweb/hgwebdir_mod.py mercurial/templates/gitweb/map mercurial/templates/monoblue/map
diffstat 3 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Tue Dec 04 00:37:50 2012 +0100
+++ b/mercurial/hgweb/hgwebdir_mod.py	Tue Nov 27 22:24:02 2012 +0100
@@ -304,7 +304,8 @@
                                description_sort="",
                                lastchange=d,
                                lastchange_sort=d[1]-d[0],
-                               archives=[])
+                               archives=[],
+                               isdirectory=True)
 
                     seendirs.add(name)
                     yield row
--- a/mercurial/templates/gitweb/map	Tue Dec 04 00:37:50 2012 +0100
+++ b/mercurial/templates/gitweb/map	Tue Nov 27 22:24:02 2012 +0100
@@ -294,7 +294,12 @@
     <td>{contact|obfuscate}</td>
     <td class="age">{lastchange|rfc822date}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
-    <td><div class="rss_logo"><a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a></div></td>
+    <td>{if(isdirectory, '',
+            '<div class="rss_logo">
+                <a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a>
+            </div>'
+            )}
+    </td>
   </tr>\n'
 indexarchiveentry = ' <a href="{url}archive/{node|short}{extension}">{type|escape}</a> '
 index = index.tmpl
--- a/mercurial/templates/monoblue/map	Tue Dec 04 00:37:50 2012 +0100
+++ b/mercurial/templates/monoblue/map	Tue Nov 27 22:24:02 2012 +0100
@@ -247,10 +247,11 @@
     <td class="age">{lastchange|rfc822date}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
     <td>
-      <div class="rss_logo">
-        <a href="{url}rss-log">RSS</a>
-        <a href="{url}atom-log">Atom</a>
-      </div>
+        {if(isdirectory, '',
+            '<div class="rss_logo">
+                <a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a>
+            </div>'
+            )}
     </td>
   </tr>\n'
 indexarchiveentry = '<a href="{url}archive/{node|short}{extension}">{type|escape}</a> '