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
 
@@ -124,9 +124,11 @@ class SummaryController(BaseRepoControll
 
        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
rhodecode/public/css/style.css
Show inline comments
 
@@ -993,7 +993,7 @@ div.options a {
 
	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
rhodecode/templates/summary/summary.html
Show inline comments
 
@@ -17,7 +17,11 @@
 
</%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()}
 
@@ -30,7 +34,16 @@
 
			  <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')}"
 
@@ -42,7 +55,6 @@
 
                      </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')}"/>
 
@@ -84,14 +96,14 @@
 
			  <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>
 
@@ -105,11 +117,11 @@
 
			  <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>
 
@@ -118,8 +130,8 @@
 
			  <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>
 
			 
 
@@ -127,8 +139,14 @@
 
			  <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>
 
			 			
 
@@ -136,12 +154,12 @@
 
			  <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:
 
@@ -161,25 +179,11 @@
 
			    %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">
 
@@ -209,6 +213,7 @@
 
    	</div>
 
    </div>
 
</div>    
 
%endif
 

	
 
<div class="box">    
 
    <div class="title">
 
@@ -235,19 +240,42 @@
 
%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;
 
@@ -311,13 +339,7 @@
 
            }
 
            
 
        }
 
        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')
 
@@ -326,29 +348,6 @@
 
            };
 
            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">
 
@@ -670,9 +669,11 @@
 
                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)