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 75 insertions and 40 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -146,21 +146,29 @@ class FilesController(BaseController):
 

	
 
        c.f_path = f_path
 

	
 
        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)
 

	
 
        try:
 
            repo.get_changeset(revision)
 
        except ChangesetDoesNotExistError:
rhodecode/controllers/summary.py
Show inline comments
 
@@ -139,8 +139,30 @@ class SummaryController(BaseController):
 
        else:
 
            c.commit_data = json.dumps({})
 
            c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 10] ])
 
            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
 
@@ -116,15 +116,46 @@
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Trending source files')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			    <div id="lang_stats">
 
			    
 
			    </div> 			  
 
			    <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){
 
				  	    id = 'clone_url';
 
				  	    YUE.on(id,'click',function(e){
 
				  	        YUD.get('clone_url').select();
 
				  	    })
 
@@ -203,45 +234,19 @@
 
			  			for (e in l){
 
			  			    YUD.setStyle(l[e],'display','');
 
			  			};
 
			  			YUD.setStyle(YUD.get('code_stats_show_more'),
 
			  					'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>
 
			 
 
			 <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>				
 
			  	
 
                
 
                YUE.on('download_options','change',function(e){
 
                    var new_cs = e.target.options[e.target.selectedIndex].value;
 
                })
 
                	
 
			  	</script>    				
 
</div>
 
        
 
<div class="box box-right"  style="min-height:455px">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Commit activity by day / author')}</h5>
 
@@ -641,7 +646,7 @@
 
        %if c.repo_changesets:
 
        	${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))}
 
        %endif
 
    </div>      
 
</div> 
 

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