summary.html
401 lines
| 14.5 KiB
| text/html
|
HtmlLexer
r547 | <%inherit file="/base/base.html"/> | |||
<%def name="title()"> | ||||
|
r4116 | ${_('%s Summary') % c.repo_name} | ||
%if c.rhodecode_name: | ||||
· ${c.rhodecode_name} | ||||
%endif | ||||
r547 | </%def> | |||
<%def name="breadcrumbs_links()"> | ||||
|
r3532 | ${_('Summary')} | ||
|
r4116 | |||
## locking icon | ||||
%if c.rhodecode_db_repo.enable_locking: | ||||
%if c.rhodecode_db_repo.locked[0]: | ||||
<span class="locking_locked tooltip" title="${_('Repository locked by %s') % h.person_by_id(c.rhodecode_db_repo.locked[0])}"></span> | ||||
%else: | ||||
<span class="locking_unlocked tooltip" title="${_('Repository unlocked')}"></span> | ||||
%endif | ||||
%endif | ||||
##FORK | ||||
%if c.rhodecode_db_repo.fork: | ||||
<span> | ||||
- <i class="icon-code-fork"></i> ${_('Fork of')} "<a href="${h.url('summary_home',repo_name=c.rhodecode_db_repo.fork.repo_name)}">${c.rhodecode_db_repo.fork.repo_name}</a>" | ||||
</span> | ||||
%endif | ||||
##REMOTE | ||||
%if c.rhodecode_db_repo.clone_uri: | ||||
<span> | ||||
- <i class="icon-code-fork"></i> ${_('Clone from')} "<a href="${h.url(str(h.hide_credentials(c.rhodecode_db_repo.clone_uri)))}">${h.hide_credentials(c.rhodecode_db_repo.clone_uri)}</a>" | ||||
<span> | ||||
%endif | ||||
r547 | </%def> | |||
<%def name="page_nav()"> | ||||
|
r3603 | ${self.menu('repositories')} | ||
r547 | </%def> | |||
r2413 | <%def name="head_extra()"> | |||
|
r4116 | <link href="${h.url('atom_feed_home',repo_name=c.rhodecode_db_repo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" /> | ||
<link href="${h.url('rss_feed_home',repo_name=c.rhodecode_db_repo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" /> | ||||
|
r3655 | |||
<script> | ||||
redirect_hash_branch = function(){ | ||||
var branch = window.location.hash.replace(/^#(.*)/, '$1'); | ||||
r3656 | if (branch){ | |||
window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}" | ||||
.replace('__BRANCH__',branch); | ||||
} | ||||
|
r3655 | } | ||
redirect_hash_branch(); | ||||
window.onhashchange = function() { | ||||
r3656 | redirect_hash_branch(); | |||
|
r3655 | }; | ||
</script> | ||||
r2413 | </%def> | |||
r547 | <%def name="main()"> | |||
|
r3988 | ${self.repo_context_bar('summary')} | ||
r1728 | <% | |||
summary = lambda n:{False:'summary-short'}.get(n) | ||||
%> | ||||
|
r4116 | <div class="box"> | ||
r547 | <!-- box / title --> | |||
<div class="title"> | ||||
${self.breadcrumbs()} | ||||
</div> | ||||
<!-- end box / title --> | ||||
|
r3197 | <div class="form"> | ||
<div id="summary" class="fields"> | ||||
|
r4116 | <div class="field"> | ||
<div class="label-summary"> | ||||
<label>${_('Clone url')}:</label> | ||||
</div> | ||||
<div class="input ${summary(c.show_stats)}"> | ||||
<input style="width:80%" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/> | ||||
<input style="display:none;width:80%" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/> | ||||
<div style="display:none" id="clone_by_name" class="btn btn-small clone">${_('Show by Name')}</div> | ||||
<div id="clone_by_id" class="btn btn-small clone">${_('Show by ID')}</div> | ||||
</div> | ||||
</div> | ||||
r1888 | ||||
|
r4116 | <div class="field"> | ||
<div class="label-summary"> | ||||
<label>${_('Description')}:</label> | ||||
</div> | ||||
%if c.visual.stylify_metatags: | ||||
<div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(c.rhodecode_db_repo.description))}</div> | ||||
%else: | ||||
<div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.rhodecode_db_repo.description)}</div> | ||||
%endif | ||||
</div> | ||||
r1888 | ||||
|
r3197 | <div class="field"> | ||
<div class="label-summary"> | ||||
<label>${_('Trending files')}:</label> | ||||
</div> | ||||
<div class="input ${summary(c.show_stats)}"> | ||||
r1719 | %if c.show_stats: | |||
|
r3197 | <div id="lang_stats"></div> | ||
r1719 | %else: | |||
r1888 | ${_('Statistics are disabled for this repository')} | |||
r1719 | %if h.HasPermissionAll('hg.admin')('enable stats on from summary'): | |||
|
r4116 | ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_statistics'),class_="btn btn-mini")} | ||
r1728 | %endif | |||
r1888 | %endif | |||
|
r3197 | </div> | ||
</div> | ||||
r1888 | ||||
|
r3197 | <div class="field"> | ||
<div class="label-summary"> | ||||
<label>${_('Download')}:</label> | ||||
</div> | ||||
<div class="input ${summary(c.show_stats)}"> | ||||
%if len(c.rhodecode_repo.revisions) == 0: | ||||
${_('There are no downloads yet')} | ||||
|
r3625 | %elif not c.enable_downloads: | ||
|
r3197 | ${_('Downloads are disabled for this repository')} | ||
r1719 | %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'): | |||
|
r4116 | ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_downloads'),class_="btn btn-mini")} | ||
r1888 | %endif | |||
|
r3197 | %else: | ||
|
r4116 | <span id="${'zip_link'}"> | ||
<a class="btn btn-small" href="${h.url('files_archive_home',repo_name=c.rhodecode_db_repo.repo_name,fname='tip.zip')}"><i class="icon-archive"></i> ${_('Download as zip')}</a> | ||||
</span> | ||||
${h.hidden('download_options')} | ||||
r1450 | <span style="vertical-align: bottom"> | |||
r3763 | <input id="archive_subrepos" type="checkbox" name="subrepos" /> | |||
<label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label> | ||||
r1450 | </span> | |||
|
r3197 | %endif | ||
</div> | ||||
</div> | ||||
|
r3529 | </div> | ||
<div id="summary-menu-stats"> | ||||
<ul> | ||||
<li> | ||||
|
r4116 | <a title="${_('Owner')} ${c.rhodecode_db_repo.user.email}"> | ||
<i class="icon-user"></i> ${c.rhodecode_db_repo.user.username} | ||||
<div class="gravatar" style="float: right; margin: 0px 0px 0px 0px" title="${c.rhodecode_db_repo.user.name} ${c.rhodecode_db_repo.user.lastname}"> | ||||
<img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email, 18)}"/> | ||||
</div> | ||||
|
r3529 | </a> | ||
</li> | ||||
<li> | ||||
|
r4116 | <a title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}"> | ||
<i class="icon-heart"></i> ${_('Followers')} | ||||
<span class="stats-bullet" id="current_followers_count">${c.repository_followers}</span> | ||||
</a> | ||||
</li> | ||||
<li> | ||||
<a title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}"> | ||||
<i class="icon-code-fork"></i> ${_('Forks')} | ||||
<span class="stats-bullet">${c.repository_forks}</span> | ||||
|
r3529 | </a> | ||
</li> | ||||
r3560 | ||||
r3664 | %if c.rhodecode_user.username != 'default': | |||
<li class="repo_size"> | ||||
|
r4116 | <a href="#" onclick="javascript:showRepoSize('repo_size_2','${c.rhodecode_db_repo.repo_name}','${str(h.get_token())}')"><i class="icon-archive"></i> ${_('Repository Size')}</a> | ||
<span class="stats-bullet" id="repo_size_2"></span> | ||||
|
r3529 | </li> | ||
r3560 | %endif | |||
<li> | ||||
%if c.rhodecode_user.username != 'default': | ||||
|
r4116 | <a href="${h.url('atom_feed_home',repo_name=c.rhodecode_db_repo.repo_name,api_key=c.rhodecode_user.api_key)}"><i class="icon-rss-sign"></i> ${_('Feed')}</a> | ||
r3560 | %else: | |||
|
r4116 | <a href="${h.url('atom_feed_home',repo_name=c.rhodecode_db_repo.repo_name)}"><i class="icon-rss-sign"></i> ${_('Feed')}</a> | ||
r3560 | %endif | |||
</li> | ||||
|
r4116 | %if c.show_stats: | ||
<li> | ||||
<a title="${_('Statistics')}" href="${h.url('repo_stats_home',repo_name=c.repo_name)}"> | ||||
<i class="icon-bar-chart"></i> ${_('Statistics')} | ||||
</a> | ||||
</li> | ||||
|
r3529 | %endif | ||
</ul> | ||||
</div> | ||||
|
r3197 | </div> | ||
r547 | </div> | |||
r1719 | ||||
r1888 | ||||
|
r4116 | <div class="box" style="margin-top: -20px"> | ||
r547 | <div class="title"> | |||
r1736 | <div class="breadcrumbs"> | |||
%if c.repo_changesets: | ||||
|
r3285 | ${h.link_to(_('Latest changes'),h.url('changelog_home',repo_name=c.repo_name))} | ||
r1736 | %else: | |||
${_('Quick start')} | ||||
%endif | ||||
</div> | ||||
r1888 | </div> | |||
r547 | <div class="table"> | |||
r637 | <div id="shortlog_data"> | |||
r3764 | <%include file='../changelog/changelog_summary_data.html'/> | |||
r637 | </div> | |||
r1605 | </div> | |||
</div> | ||||
%if c.readme_data: | ||||
r2990 | <div id="readme" class="anchor"> | |||
<div class="box" style="background-color: #FAFAFA"> | ||||
|
r4116 | <div class="title" title="${_('Readme file from revision %s:%s') % (c.rhodecode_db_repo.landing_rev[0], c.rhodecode_db_repo.landing_rev[1])}"> | ||
r2606 | <div class="breadcrumbs"> | |||
<a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a> | ||||
</div> | ||||
r1888 | </div> | |||
r2990 | <div class="readme"> | |||
r1605 | <div class="readme_box"> | |||
${c.readme_data|n} | ||||
</div> | ||||
r547 | </div> | |||
</div> | ||||
r2990 | </div> | |||
r1605 | %endif | |||
<script type="text/javascript"> | ||||
r1719 | var clone_url = 'clone_url'; | |||
YUE.on(clone_url,'click',function(e){ | ||||
if(YUD.hasClass(clone_url,'selected')){ | ||||
return | ||||
} | ||||
else{ | ||||
YUD.addClass(clone_url,'selected'); | ||||
r1888 | YUD.get(clone_url).select(); | |||
r1719 | } | |||
}) | ||||
r1813 | YUE.on('clone_by_name','click',function(e){ | |||
// show url by name and hide name button | ||||
YUD.setStyle('clone_url','display',''); | ||||
YUD.setStyle('clone_by_name','display','none'); | ||||
r1888 | ||||
r1813 | // hide url by id and show name button | |||
YUD.setStyle('clone_by_id','display',''); | ||||
r1888 | YUD.setStyle('clone_url_id','display','none'); | |||
r1813 | }) | |||
YUE.on('clone_by_id','click',function(e){ | ||||
r1888 | ||||
|
r3197 | // show url by id and hide id button | ||
YUD.setStyle('clone_by_id','display','none'); | ||||
r1813 | YUD.setStyle('clone_url_id','display',''); | |||
r1888 | ||||
r1813 | // hide url by name and show id button | |||
|
r3197 | YUD.setStyle('clone_by_name','display',''); | ||
YUD.setStyle('clone_url','display','none'); | ||||
r1813 | }) | |||
|
r4116 | $(document).ready(function(){ | ||
var cache = {} | ||||
$("#download_options").select2({ | ||||
placeholder: _TM['Select changeset'], | ||||
dropdownAutoWidth: true, | ||||
query: function(query){ | ||||
var key = 'cache'; | ||||
var cached = cache[key] ; | ||||
if(cached) { | ||||
var data = {results: []}; | ||||
//filter results | ||||
$.each(cached.results, function(){ | ||||
var section = this.text; | ||||
var children = []; | ||||
$.each(this.children, function(){ | ||||
if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){ | ||||
children.push({'id': this.id, 'text': this.text}) | ||||
} | ||||
}) | ||||
data.results.push({'text': section, 'children': children}) | ||||
}); | ||||
query.callback(data); | ||||
}else{ | ||||
$.ajax({ | ||||
url: pyroutes.url('repo_refs_data', {'repo_name': '${c.repo_name}'}), | ||||
data: {}, | ||||
dataType: 'json', | ||||
type: 'GET', | ||||
success: function(data) { | ||||
cache[key] = data; | ||||
query.callback({results: data.results}); | ||||
} | ||||
}) | ||||
} | ||||
}, | ||||
}); | ||||
// on change of download options | ||||
$('#download_options').change(function(e){ | ||||
var new_cs = e.added | ||||
r1888 | ||||
|
r4116 | for(k in tmpl_links){ | ||
var s = $('#'+k+'_link'); | ||||
if(s){ | ||||
var title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}"; | ||||
title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text); | ||||
title_tmpl = title_tmpl.replace('__CS_EXT__',k); | ||||
title_tmpl = '<i class="icon-archive"></i> '+ title_tmpl; | ||||
var url = tmpl_links[k].replace('__CS__',new_cs.id); | ||||
var subrepos = $('#archive_subrepos').is(':checked'); | ||||
url = url.replace('__SUB__',subrepos); | ||||
url = url.replace('__NAME__',title_tmpl); | ||||
r1888 | ||||
|
r4116 | s.html(url) | ||
} | ||||
r1751 | } | |||
|
r4116 | }); | ||
var tmpl_links = {}; | ||||
%for cnt,archive in enumerate(c.rhodecode_repo._get_archives()): | ||||
tmpl_links["${archive['type']}"] = '${h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.rhodecode_db_repo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='btn btn-small')}'; | ||||
%endfor | ||||
}) | ||||
r1719 | </script> | |||
|
r4116 | |||
r1719 | %if c.show_stats: | |||
<script type="text/javascript"> | ||||
var data = ${c.trending_languages|n}; | ||||
var total = 0; | ||||
var no_data = true; | ||||
var tbl = document.createElement('table'); | ||||
tbl.setAttribute('class','trending_language_tbl'); | ||||
var cnt = 0; | ||||
r1890 | for (var i=0;i<data.length;i++){ | |||
|
r3197 | total+= data[i][1].count; | ||
r1940 | } | |||
for (var i=0;i<data.length;i++){ | ||||
r1719 | cnt += 1; | |||
r1890 | no_data = false; | |||
r1908 | ||||
r1719 | var hide = cnt>2; | |||
var tr = document.createElement('tr'); | ||||
if (hide){ | ||||
tr.setAttribute('style','display:none'); | ||||
tr.setAttribute('class','stats_hidden'); | ||||
} | ||||
r1890 | var k = data[i][0]; | |||
var obj = data[i][1]; | ||||
var percentage = Math.round((obj.count/total*100),2); | ||||
r1908 | ||||
r1719 | var td1 = document.createElement('td'); | |||
td1.width = 150; | ||||
var trending_language_label = document.createElement('div'); | ||||
r1890 | trending_language_label.innerHTML = obj.desc+" ("+k+")"; | |||
r1719 | td1.appendChild(trending_language_label); | |||
r1605 | ||||
r1719 | var td2 = document.createElement('td'); | |||
td2.setAttribute('style','padding-right:14px !important'); | ||||
var trending_language = document.createElement('div'); | ||||
r1890 | var nr_files = obj.count+" ${_('files')}"; | |||
r1888 | ||||
r1719 | trending_language.title = k+" "+nr_files; | |||
r1888 | ||||
r1719 | if (percentage>22){ | |||
r1888 | trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>"; | |||
r1719 | } | |||
else{ | ||||
trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>"; | ||||
} | ||||
r1888 | ||||
r1719 | trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner'); | |||
trending_language.style.width=percentage+"%"; | ||||
td2.appendChild(trending_language); | ||||
r1888 | ||||
r1719 | tr.appendChild(td1); | |||
tr.appendChild(td2); | ||||
tbl.appendChild(tr); | ||||
if(cnt == 3){ | ||||
var show_more = document.createElement('tr'); | ||||
var td = document.createElement('td'); | ||||
lnk = document.createElement('a'); | ||||
r1888 | ||||
r1719 | lnk.href='#'; | |||
|
r3654 | lnk.innerHTML = "${_('Show more')}"; | ||
r1719 | lnk.id='code_stats_show_more'; | |||
td.appendChild(lnk); | ||||
r1888 | ||||
r1719 | show_more.appendChild(td); | |||
show_more.appendChild(document.createElement('td')); | ||||
tbl.appendChild(show_more); | ||||
} | ||||
r1888 | ||||
r1719 | } | |||
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'); | ||||
}); | ||||
r1888 | </script> | |||
r1719 | %endif | |||
r547 | ||||
r1888 | </%def> | |||