Changeset - 32318ec7bfc1
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 15 years ago 2011-01-13 23:35:46
marcin@python-works.com
added branch/tag options to download links in summary
3 files changed with 70 insertions and 35 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -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)
 

	
rhodecode/controllers/summary.py
Show inline comments
 
@@ -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
rhodecode/templates/summary/summary.html
Show inline comments
 
@@ -119,8 +119,39 @@
 
			      <label>${_('Trending source files')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			    <div id="lang_stats">
 
			    <div id="lang_stats"></div> 			   
 
			  </div>
 
			 </div>
 
			 			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Download')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
		        
 
		        ${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
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Feeds')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
	            ${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')}
 
			  </div>
 
			 </div>				 			 			 
 
	  </div>		 
 
			    </div> 			  
 
			  	<script type="text/javascript">
 
				  	YUE.onDOMReady(function(e){
 
@@ -207,38 +238,12 @@
 
			  					'display','none');
 
			  		})
 
			  		
 
			  	</script>
 
 
 
			  </div>
 
			 </div>
 
			 			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Download')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
		        %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
 
			  </div>
 
			 </div>
 
                YUE.on('download_options','change',function(e){
 
                    var new_cs = e.target.options[e.target.selectedIndex].value;
 
                })
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Feeds')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
	            ${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')}
 
			  </div>
 
			 </div>				 			 			 
 
	  </div>		 
 
	</div>				
 
			  	</script>    				
 
</div>
 
        
 
<div class="box box-right"  style="min-height:455px">
 
@@ -644,4 +649,4 @@
 
    </div>      
 
</div> 
 

	
 
</%def>    
 
\ No newline at end of file
 
</%def>    
0 comments (0 inline, 0 general)