Changeset - 4a28aff31a15
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 14 years ago 2011-11-25 19:05:59
marcin@python-works.com
optimized summary page for disabled stats
3 files changed with 68 insertions and 65 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/summary.py
Show inline comments
 
@@ -121,15 +121,17 @@ class SummaryController(BaseRepoControll
 

	
 
        ts_min_m = mktime(td_1m.timetuple())
 
        ts_min_y = mktime(td_1y.timetuple())
 
        ts_max_y = mktime(td.timetuple())
 

	
 
        if dbrepo.enable_statistics:
 
            c.show_stats = True
 
            c.no_data_msg = _('No data loaded yet')
 
            run_task(get_commits_stats, c.dbrepo.repo_name, ts_min_y, ts_max_y)
 
        else:
 
            c.show_stats = False
 
            c.no_data_msg = _('Statistics are disabled for this repository')
 
        c.ts_min = ts_min_m
 
        c.ts_max = ts_max_y
 

	
 
        stats = self.sa.query(Statistics)\
 
            .filter(Statistics.repository == dbrepo)\
rhodecode/public/css/style.css
Show inline comments
 
@@ -990,13 +990,13 @@ div.options a {
 
 
#content div.box div.form div.fields div.field div.label {
 
	left: 70px;
 
	width: 155px;
 
	position: absolute;
 
	margin: 0;
 
	padding: 8px 0 0 5px;
 
	padding: 0px 0 0 0px;
 
}
 
 
#content div.box-left div.form div.fields div.field div.label,#content div.box-right div.form div.fields div.field div.label
 
	{
 
	clear: both;
 
	overflow: hidden;
rhodecode/templates/summary/summary.html
Show inline comments
 
@@ -14,38 +14,50 @@
 

	
 
<%def name="page_nav()">
 
	${self.menu('summary')}    
 
</%def>
 

	
 
<%def name="main()">
 
    %if c.show_stats:
 
<div class="box box-left">
 
    %else:
 
        <div class="box">
 
    %endif
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <!-- end box / title -->
 
	<div class="form">
 
	  <div id="summary" class="fields">
 
		 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Name')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			  <div class="input">
 
                  <div style="float:right;padding-top:5px">		  
 
                     %if c.rhodecode_user.username != 'default':
 
                      ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='rss_icon')}
 
                      ${h.link_to(_('ATOM'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='atom_icon')}
 
                     %else:
 
                      ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name),class_='rss_icon')}
 
                      ${h.link_to(_('ATOM'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='atom_icon')}            
 
                     %endif  
 
                  </div>
 
                  %if c.rhodecode_user.username != 'default':
 
                      %if c.following:
 
                      <span id="follow_toggle" class="following" title="${_('Stop following this repository')}"
 
                            onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
 
                      </span>                 
 
                      %else:
 
                      <span id="follow_toggle" class="follow" title="${_('Start following this repository')}"
 
                            onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
 
                      </span>
 
                      %endif
 
                  %endif:			  
 
                 
 
                 ##REPO TYPE
 
		         %if c.dbrepo.repo_type =='hg':
 
		           <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
 
		         %endif
 
		         %if c.dbrepo.repo_type =='git':
 
		           <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
 
@@ -81,20 +93,20 @@
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Description')}:</label>
 
			  </div>
 
			  <div class="input-short desc">${h.urlify_text(c.dbrepo.description)}</div>
 
			  <div class="input desc">${h.urlify_text(c.dbrepo.description)}</div>
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Contact')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			  <div class="input">
 
			  	<div class="gravatar">
 
			  		<img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/>
 
			  	</div>
 
			  		${_('Username')}: ${c.dbrepo.user.username}<br/>
 
			  		${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/>
 
			  		${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a>
 
@@ -102,49 +114,55 @@
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Last change')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			  <div class="input">
 
                  <b>${'r%s:%s' % (h.get_changeset_safe(c.rhodecode_repo,'tip').revision,
 
                            h.get_changeset_safe(c.rhodecode_repo,'tip').short_id)}</b> - 
 
			      <span class="tooltip" title="${c.rhodecode_repo.last_change}">
 
			      ${h.age(c.rhodecode_repo.last_change)}</span><br/>
 
			      ${h.age(c.rhodecode_repo.last_change)}</span>
 
			      ${_('by')} ${h.get_changeset_safe(c.rhodecode_repo,'tip').author} 
 
			  </div>
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Clone url')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			      <input type="text" id="clone_url" readonly="readonly" value="${c.rhodecode_repo.alias} clone ${c.clone_repo_url}" size="70"/>
 
			  <div class="input">
 
			      <input type="text" id="clone_url" readonly="readonly" value="${c.rhodecode_repo.alias} clone ${c.clone_repo_url}" size="65"/>
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Trending source files')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			  <div class="input">
 
                %if c.show_stats:
 
			    <div id="lang_stats"></div> 			   
 
                %else:
 
                   %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
 
                        ${_('Statistics are disabled for this repository')} ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-button-small")}
 
                   %endif                  
 
                %endif		   
 
			  </div>
 
			 </div>
 
			 			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Download')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			  <div class="input">
 
		        %if len(c.rhodecode_repo.revisions) == 0:
 
		          ${_('There are no downloads yet')}
 
		        %elif c.enable_downloads is False:
 
		          ${_('Downloads are disabled for this repository')}
 
                    %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
 
                    %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
 
                        ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-button-small")}
 
                    %endif  		          
 
		        %else:
 
			        ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)}
 
			        %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
 
			             %if cnt >=1:
 
@@ -158,31 +176,17 @@
 
                    <span style="vertical-align: bottom">
 
                        <input id="archive_subrepos" type="checkbox" name="subrepos"/> <span class="tooltip" title="${_('Check this to download archive with subrepos')}" >${_('with subrepos')}</span>
 
                    </span>
 
			    %endif
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Feeds')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			   %if c.rhodecode_user.username != 'default':
 
	            ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='rss_icon')}
 
	            ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='atom_icon')}
 
	           %else:
 
                ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name),class_='rss_icon')}
 
                ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='atom_icon')}	           
 
	           %endif 
 
			  </div>
 
			 </div>				 			 			 
 
	  </div>		 
 
	</div>
 
</div>
 
        
 
%if c.show_stats:        
 
<div class="box box-right"  style="min-height:455px">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Commit activity by day / author')}</h5>
 
    </div>
 
    
 
@@ -206,12 +210,13 @@
 
	    	<div id="legend_choices">
 
				<table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table>
 
	    	</div>
 
    	</div>
 
    </div>
 
</div>    
 
%endif
 

	
 
<div class="box">    
 
    <div class="title">
 
        <div class="breadcrumbs">${h.link_to(_('Shortlog'),h.url('shortlog_home',repo_name=c.repo_name))}</div>
 
    </div>    
 
    <div class="table">
 
@@ -232,25 +237,48 @@
 
      </div>
 
    </div>
 
</div>
 
%endif
 

	
 
<script type="text/javascript">
 
        YUE.onDOMReady(function(e){
 
            id = 'clone_url';
 
            YUE.on(id,'click',function(e){
 
                if(YUD.hasClass(id,'selected')){
 
var clone_url = 'clone_url';
 
YUE.on(clone_url,'click',function(e){
 
    if(YUD.hasClass(clone_url,'selected')){
 
                    return
 
                }
 
                else{
 
                    YUD.addClass(id,'selected');
 
                    YUD.get(id).select();                   
 
        YUD.addClass(clone_url,'selected');
 
        YUD.get(clone_url).select();                   
 
                }
 
})
 

	
 
            })
 
        })
 
var tmpl_links = {};
 
%for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
 
  tmpl_links['${archive['type']}'] = '${h.link_to(archive['type'],
 
       h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
 
       fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_="archive_icon")}';
 
%endfor
 

	
 
YUE.on(['download_options','archive_subrepos'],'change',function(e){
 
   var sm = YUD.get('download_options');
 
   var new_cs = sm.options[sm.selectedIndex];
 
   
 
   for(k in tmpl_links){
 
       var s = YUD.get(k+'_link');
 
       title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
 
       s.title = title_tmpl.replace('__CS_NAME__',new_cs.text);
 
       s.title = s.title.replace('__CS_EXT__',k);
 
       var url = tmpl_links[k].replace('__CS__',new_cs.value);
 
       var subrepos = YUD.get('archive_subrepos').checked
 
       url = url.replace('__SUB__',subrepos);
 
       s.innerHTML = url 
 
   }
 
});
 
</script>
 
%if c.show_stats:
 
<script type="text/javascript">
 
        var data = ${c.trending_languages|n};
 
        var total = 0;
 
        var no_data = true;
 
        for (k in data){
 
            total += data[k].count;
 
            no_data = false;
 
@@ -308,50 +336,21 @@
 
                show_more.appendChild(td);
 
                show_more.appendChild(document.createElement('td'));
 
                tbl.appendChild(show_more);
 
            }
 
            
 
        }
 
        if(no_data){
 
            var tr = document.createElement('tr');
 
            var td1 = document.createElement('td');
 
            td1.innerHTML = "${c.no_data_msg}";
 
            tr.appendChild(td1);
 
            tbl.appendChild(tr);
 
        }
 

	
 
        YUD.get('lang_stats').appendChild(tbl);
 
        YUE.on('code_stats_show_more','click',function(){
 
            l = YUD.getElementsByClassName('stats_hidden')
 
            for (e in l){
 
                YUD.setStyle(l[e],'display','');
 
            };
 
            YUD.setStyle(YUD.get('code_stats_show_more'),
 
                    'display','none');
 
        })
 
    
 
             var tmpl_links = {}
 
              %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
 
                tmpl_links['${archive['type']}'] = '${h.link_to(archive['type'],
 
                     h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
 
                     fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_="archive_icon")}';
 
              %endfor
 
              
 
             YUE.on(['download_options','archive_subrepos'],'change',function(e){
 
                 var sm = YUD.get('download_options');
 
                 var new_cs = sm.options[sm.selectedIndex];
 
                 
 
                 for(k in tmpl_links){
 
                     var s = YUD.get(k+'_link');
 
                     title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
 
                     s.title = title_tmpl.replace('__CS_NAME__',new_cs.text);
 
                     s.title = s.title.replace('__CS_EXT__',k);
 
                     var url = tmpl_links[k].replace('__CS__',new_cs.value);
 
                     var subrepos = YUD.get('archive_subrepos').checked
 
                     url = url.replace('__SUB__',subrepos);
 
                     s.innerHTML = url 
 
                 }
 
             });
 
    </script>   
 
<script type="text/javascript">
 
        /**
 
         * Plots summary graph
 
         *
 
@@ -667,12 +666,14 @@
 
            plot.subscribe("plothover", plothover)
 
            
 
            overview.subscribe("plotselected", function (ranges) {
 
                plot.setSelection(ranges);
 
            });     
 

	
 
    // user choices on overview
 
            YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
 
        }
 
            SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});       
 
        </script>
 
%endif
 

	
 
</%def>    
0 comments (0 inline, 0 general)