unrhodecode/rhodecode/templates/summary/summary.mako
russell@unturf.com be07de2f57 Modernize repo summary page with GitHub-style layout
Two-column grid: main content + About sidebar.
Extract clone_url_bar component from old summary_detail.
Add repo stats bar (branches, tags, commits, forks).
Move repo metadata (owner, description, dates) into visible
About sidebar instead of hidden behind Show More toggle.
Auto-load language stats when enabled.
2026-03-04 18:48:47 -05:00

179 lines
6.3 KiB
Mako

<%inherit file="/summary/summary_base.mako"/>
<%namespace name="components" file="/summary/components.mako"/>
<%namespace name="base" file="/base/base.mako"/>
<%def name="menu_bar_subnav()">
${self.repo_menu(active='summary')}
</%def>
<%def name="main()">
<div class="repo-summary-grid">
<div class="repo-summary-main">
## Clone URL bar
${components.clone_url_bar()}
## Branch/tag stats bar
<div class="repo-stats-bar">
${components.refs_counters(
c.rhodecode_repo.branches if c.rhodecode_repo else [],
c.rhodecode_repo.branches_closed if c.rhodecode_repo else [],
c.rhodecode_repo.tags if c.rhodecode_repo else [],
c.rhodecode_repo.bookmarks if c.rhodecode_repo else [])}
<% commit_rev = h.safe_int(c.rhodecode_db_repo.changeset_cache.get('revision'), 0) + 1 %>
<span class="summary-tag">
% if commit_rev > 0:
<a href="${h.route_path('repo_commits', repo_name=c.repo_name)}">
<i class="icon-history"></i>
<span>${commit_rev}</span> ${_ungettext('Commit', 'Commits', commit_rev)}
</a>
% else:
<i class="icon-history"></i>
<span>0</span> ${_('Commits')}
% endif
</span>
<span class="summary-tag">
<a href="${h.route_path('repo_forks_show_all', repo_name=c.repo_name)}">
<i class="icon-code-fork"></i>
<span>${c.repository_forks}</span> ${_ungettext('Fork', 'Forks', c.repository_forks)}
</a>
</span>
</div>
## Recent commits
<div class="repo-commits-section">
%if c.repo_commits:
<div class="table">
<div id="shortlog_data">
<%include file='summary_commits.mako'/>
</div>
</div>
%else:
<%include file='summary_commits.mako'/>
%endif
</div>
## README
%if c.readme_data:
<div id="readme" class="anchor">
<div class="readme-container">
<div class="readme-title">
<i class="icon-file-text"></i>
<a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_ref_name,f_path=c.readme_file)}">
${c.readme_file}
</a>
</div>
<div class="readme codeblock">
<div class="readme_box">
${c.readme_data|n}
</div>
</div>
</div>
</div>
%endif
</div>
<div class="repo-summary-sidebar">
## About section
<div class="repo-about">
<h4 class="sidebar-heading">${_('About')}</h4>
% if c.rhodecode_db_repo.description:
<p class="repo-description">
<%namespace name="dt" file="/data_table/_dt_elements.mako"/>
${dt.repo_desc(c.rhodecode_db_repo.description_safe, c.visual.stylify_metatags)}
</p>
% endif
<div class="repo-meta-list">
<div class="repo-meta-item">
<i class="icon-user"></i>
${base.gravatar_with_user(c.rhodecode_db_repo.user.email, 16, tooltip=True)}
</div>
% if c.rhodecode_db_repo.landing_ref_name:
<div class="repo-meta-item">
<i class="icon-branch"></i>
<span>${c.rhodecode_db_repo.landing_ref_name}</span>
</div>
% endif
<div class="repo-meta-item">
<i class="icon-calendar"></i>
<span>${h.format_date(c.rhodecode_db_repo.created_on)}</span>
</div>
% if c.rhodecode_db_repo.fork:
<div class="repo-meta-item">
<i class="icon-code-fork"></i>
<a href="${h.route_path('repo_summary',repo_name=c.rhodecode_db_repo.fork.repo_name)}">${_('Forked from')} ${c.rhodecode_db_repo.fork.repo_name}</a>
</div>
% endif
</div>
</div>
## Downloads section
% if c.enable_downloads and c.rhodecode_repo and len(c.rhodecode_repo.commit_ids) > 0:
<div class="repo-about">
<h4 class="sidebar-heading">${_('Downloads')}</h4>
<div class="repo-downloads">
% for a_type, content_type, extension in h.ARCHIVE_SPECS:
<a class="archive_link btn btn-small btn-default" data-ext="${extension}" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname=c.rhodecode_db_repo.landing_ref_name+extension, _query={'with_hash': '1'})}" rel="nofollow">
<i class="icon-download"></i> ${c.rhodecode_db_repo.landing_ref_name}${extension}
</a>
% endfor
</div>
</div>
% endif
## Statistics
% if c.show_stats:
<div class="repo-about">
<h4 class="sidebar-heading">${_('Languages')}</h4>
<div id="lang_stats"></div>
<div id="repo_size_container"></div>
</div>
% endif
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var showCloneField = function(clone_url_format){
$.each(['http', 'http_id', 'ssh'], function (idx, val) {
if(val === clone_url_format){
$('#clone_option_' + val).show();
$('#clone_option').val(val)
} else {
$('#clone_option_' + val).hide();
}
});
};
showCloneField(templateContext.session_attrs.clone_url_format);
$('#clone_option').on('change', function(e) {
var selected = $(this).val();
storeUserSessionAttr('rc_user_session_attr.clone_url_format', selected);
showCloneField(selected)
});
% if c.show_stats:
// auto-load stats
var callback = function (data) {
showRepoStats('lang_stats', data);
};
showRepoSize('repo_size_container', templateContext.repo_name, templateContext.repo_landing_commit, callback);
% endif
})
</script>
</%def>