diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -149,15 +149,23 @@ class FilesController(BaseController): return render('files/files_annotate.html') def archivefile(self, repo_name, fname): - info = fname.split('.') - revision, fileformat = info[0], '.' + '.'.join(info[1:]) archive_specs = { '.tar.bz2': ('application/x-tar', 'tbz2'), '.tar.gz': ('application/x-tar', 'tgz'), '.zip': ('application/zip', 'zip'), } + + fileformat = None + revision = None + + for ext in archive_specs.keys(): + archive_spec = fname.split(ext) + if len(archive_spec) == 2: + fileformat = archive_spec[1] or ext + revision = archive_spec[0] + if not archive_specs.has_key(fileformat): - return _('Unknown archive type %s') % fileformat + return _('Unknown archive type') repo = ScmModel().get_repo(repo_name) diff --git a/rhodecode/controllers/summary.py b/rhodecode/controllers/summary.py --- a/rhodecode/controllers/summary.py +++ b/rhodecode/controllers/summary.py @@ -142,5 +142,27 @@ class SummaryController(BaseController): c.trending_languages = json.dumps({}) c.no_data = True + c.download_options = self._get_download_links(c.repo_info) + return render('summary/summary.html') + + + def _get_download_links(self, repo): + + download_l = [] + + branches_group = ([], _("Branches")) + tags_group = ([], _("Tags")) + + for name, chs in c.repository_branches.items(): + #chs = chs.split(':')[-1] + branches_group[0].append((chs, name),) + download_l.append(branches_group) + + for name, chs in c.repository_tags.items(): + #chs = chs.split(':')[-1] + tags_group[0].append((chs, name),) + download_l.append(tags_group) + + return download_l diff --git a/rhodecode/templates/summary/summary.html b/rhodecode/templates/summary/summary.html --- a/rhodecode/templates/summary/summary.html +++ b/rhodecode/templates/summary/summary.html @@ -119,9 +119,40 @@
-
- -
+
+
+ + +
+
+ +
+
+ + ${h.select('download_options','tip',c.download_options)} + + %for cnt,archive in enumerate(c.repo_info._get_archives()): + %if cnt >=1: + | + %endif + ${h.link_to(archive['type'], + h.url('files_archive_home',repo_name=c.repo_info.name, + fname='tip'+archive['extension']),class_="archive_icon")} + %endfor +
+
+ +
+
+ +
+
+ ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')} + ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')} +
+
+ + - - - - -
-
- -
-
- %for cnt,archive in enumerate(c.repo_info._get_archives()): - %if cnt >=1: - | - %endif - ${h.link_to(c.repo_info.name+'.'+archive['type'], - h.url('files_archive_home',repo_name=c.repo_info.name, - fname='tip'+archive['extension']),class_="archive_icon")} - %endfor -
-
- -
-
- -
-
- ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')} - ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')} -
-
- - + + + YUE.on('download_options','change',function(e){ + var new_cs = e.target.options[e.target.selectedIndex].value; + }) + +
@@ -644,4 +649,4 @@
- \ No newline at end of file +