|
|
## -*- coding: utf-8 -*-
|
|
|
|
|
|
<%inherit file="/base/base.html"/>
|
|
|
|
|
|
<%namespace name="changelog_table" file="changelog_table.html"/>
|
|
|
|
|
|
<%block name="title">
|
|
|
${_('%s Changelog') % c.repo_name}
|
|
|
%if c.changelog_for_path:
|
|
|
/${c.changelog_for_path}
|
|
|
%endif
|
|
|
</%block>
|
|
|
|
|
|
<%def name="breadcrumbs_links()">
|
|
|
<% size = c.size if c.size <= c.total_cs else c.total_cs %>
|
|
|
${_('Changelog')}
|
|
|
%if c.changelog_for_path:
|
|
|
- /${c.changelog_for_path}
|
|
|
%endif
|
|
|
%if c.revision:
|
|
|
@ ${c.first_revision.short_id}
|
|
|
%endif
|
|
|
- ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
|
|
|
</%def>
|
|
|
|
|
|
<%block name="header_menu">
|
|
|
${self.menu('repositories')}
|
|
|
</%block>
|
|
|
|
|
|
<%def name="main()">
|
|
|
${self.repo_context_bar('changelog', c.first_revision.raw_id if c.first_revision else None)}
|
|
|
<div class="panel panel-primary">
|
|
|
<div class="panel-heading clearfix">
|
|
|
${self.breadcrumbs()}
|
|
|
</div>
|
|
|
<div class="panel-body changelog-panel">
|
|
|
%if c.cs_pagination:
|
|
|
<div class="changelog-heading clearfix" style="${'display:none' if c.changelog_for_path else ''}">
|
|
|
<div class="pull-left">
|
|
|
${h.form(h.url.current(),method='get',class_="form-inline")}
|
|
|
${h.submit(None,_('Show'),id='set_size_submit',class_="btn btn-default btn-sm")}
|
|
|
${h.text('size',size=3,value=c.size,class_='form-control')}
|
|
|
${_('revisions')}
|
|
|
%if c.branch_name:
|
|
|
${h.hidden('branch', c.branch_name)}
|
|
|
%endif
|
|
|
<a href="#" class="btn btn-default btn-sm" id="rev_range_clear" style="display:none">${_('Clear selection')}</a>
|
|
|
${h.end_form()}
|
|
|
</div>
|
|
|
<div class="pull-right">
|
|
|
<a href="#" class="btn btn-default btn-sm" id="rev_range_container" style="display:none"></a>
|
|
|
%if c.revision:
|
|
|
<a class="btn btn-default btn-sm" href="${h.url('changelog_home', repo_name=c.repo_name)}">
|
|
|
${_('Go to tip of repository')}
|
|
|
</a>
|
|
|
%endif
|
|
|
%if c.db_repo.fork:
|
|
|
<a id="compare_fork"
|
|
|
title="${_('Compare fork with %s' % c.db_repo.fork.repo_name)}"
|
|
|
href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1],other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}"
|
|
|
class="btn btn-default btn-sm"><i class="icon-git-compare"></i>${_('Compare fork with parent repository (%s)' % c.db_repo.fork.repo_name)}</a>
|
|
|
%endif
|
|
|
## text and href of open_new_pr is controlled from javascript
|
|
|
<a id="open_new_pr" class="btn btn-default btn-sm"></a>
|
|
|
${_("Branch filter:")} ${h.select('branch_filter',c.branch_name,c.branch_filters)}
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div id="graph_nodes">
|
|
|
<canvas id="graph_canvas" style="width:0"></canvas>
|
|
|
</div>
|
|
|
|
|
|
<div id="graph_content" style="${'margin: 0px' if c.changelog_for_path else ''}">
|
|
|
${changelog_table.changelog(c.repo_name, c.cs_pagination, c.cs_statuses, c.cs_comments,
|
|
|
show_checkbox=not c.changelog_for_path,
|
|
|
show_branch=not c.branch_name,
|
|
|
resize_js='graph.render(jsdata)')}
|
|
|
<input type="checkbox" id="singlerange" style="display:none"/>
|
|
|
</div>
|
|
|
|
|
|
${c.cs_pagination.pager()}
|
|
|
|
|
|
<script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
|
|
|
<script>
|
|
|
'use strict';
|
|
|
var jsdata = ${h.js(c.jsdata)};
|
|
|
var graph = new BranchRenderer('graph_canvas', 'graph_content', 'chg_');
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
var $checkboxes = $('.changeset_range');
|
|
|
|
|
|
pyroutes.register('changeset_home', ${h.js(h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s'))}, ['repo_name', 'revision']);
|
|
|
|
|
|
function checkbox_checker() {
|
|
|
var $checked_checkboxes = $checkboxes.filter(':checked');
|
|
|
var $singlerange = $('#singlerange');
|
|
|
|
|
|
$('#rev_range_container').hide();
|
|
|
$checkboxes.show();
|
|
|
$singlerange.show();
|
|
|
|
|
|
if ($checked_checkboxes.length > 0) {
|
|
|
$checked_checkboxes.first().parent('td').append($singlerange);
|
|
|
var singlerange = $singlerange.prop('checked');
|
|
|
var rev_end = $checked_checkboxes.first().prop('name');
|
|
|
if ($checked_checkboxes.length > 1 || singlerange) {
|
|
|
var rev_start = $checked_checkboxes.last().prop('name');
|
|
|
$('#rev_range_container').prop('href',
|
|
|
pyroutes.url('changeset_home', {'repo_name': ${h.js(c.repo_name)},
|
|
|
'revision': rev_start + '...' + rev_end}));
|
|
|
$('#rev_range_container').html(
|
|
|
_TM['Show Selected Changesets {0} → {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
|
|
|
$('#rev_range_container').show();
|
|
|
$('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
|
|
|
{'repo_name': ${h.js(c.repo_name)},
|
|
|
'rev_start': rev_start,
|
|
|
'rev_end': rev_end}));
|
|
|
$('#open_new_pr').html(_TM['Open New Pull Request for {0} → {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
|
|
|
} else {
|
|
|
$('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
|
|
|
{'repo_name': ${h.js(c.repo_name)},
|
|
|
'rev_end': rev_end}));
|
|
|
$('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(rev_end.substr(0, 12)));
|
|
|
}
|
|
|
$('#rev_range_clear').show();
|
|
|
$('#compare_fork').hide();
|
|
|
|
|
|
var disabled = true;
|
|
|
$checkboxes.each(function(){
|
|
|
var $this = $(this);
|
|
|
if (disabled) {
|
|
|
if ($this.prop('checked')) {
|
|
|
$this.closest('tr').removeClass('out-of-range');
|
|
|
disabled = singlerange;
|
|
|
} else {
|
|
|
$this.closest('tr').addClass('out-of-range');
|
|
|
}
|
|
|
} else {
|
|
|
$this.closest('tr').removeClass('out-of-range');
|
|
|
disabled = $this.prop('checked');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if ($checked_checkboxes.length + (singlerange ? 1 : 0) >= 2) {
|
|
|
$checkboxes.hide();
|
|
|
$checked_checkboxes.show();
|
|
|
if (!singlerange)
|
|
|
$singlerange.hide();
|
|
|
}
|
|
|
} else {
|
|
|
$('#singlerange').hide().prop('checked', false);
|
|
|
$('#rev_range_clear').hide();
|
|
|
%if c.revision:
|
|
|
$('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
|
|
|
{'repo_name': ${h.js(c.repo_name)},
|
|
|
'rev_end':${h.js(c.first_revision.raw_id)}}));
|
|
|
$('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.revision)}));
|
|
|
%else:
|
|
|
$('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
|
|
|
{'repo_name': ${h.js(c.repo_name)},
|
|
|
'branch':${h.js(c.first_revision.branch)}}));
|
|
|
$('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.first_revision.branch)}));
|
|
|
%endif
|
|
|
$('#compare_fork').show();
|
|
|
$checkboxes.closest('tr').removeClass('out-of-range');
|
|
|
}
|
|
|
}
|
|
|
checkbox_checker();
|
|
|
$checkboxes.click(function() {
|
|
|
checkbox_checker();
|
|
|
graph.render(jsdata);
|
|
|
});
|
|
|
$('#singlerange').click(checkbox_checker);
|
|
|
|
|
|
$('#rev_range_clear').click(function(){
|
|
|
$checkboxes.prop('checked', false);
|
|
|
checkbox_checker();
|
|
|
graph.render(jsdata);
|
|
|
});
|
|
|
|
|
|
var $msgs = $('.message');
|
|
|
// get first element height
|
|
|
var el = $('#graph_content tr')[0];
|
|
|
var row_h = el.clientHeight;
|
|
|
$msgs.each(function() {
|
|
|
var m = this;
|
|
|
|
|
|
var h = m.clientHeight;
|
|
|
if(h > row_h){
|
|
|
var offset = row_h - (h+12);
|
|
|
$(m.nextElementSibling).css('display', 'block');
|
|
|
$(m.nextElementSibling).css('margin-top', offset+'px');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// change branch filter
|
|
|
$("#branch_filter").select2({
|
|
|
dropdownAutoWidth: true,
|
|
|
maxResults: 50,
|
|
|
sortResults: branchSort
|
|
|
});
|
|
|
|
|
|
$("#branch_filter").change(function(e){
|
|
|
var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
|
|
|
if(selected_branch != ''){
|
|
|
window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)},
|
|
|
'branch': selected_branch});
|
|
|
}else{
|
|
|
window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)}});
|
|
|
}
|
|
|
$("#changelog").hide();
|
|
|
});
|
|
|
|
|
|
graph.render(jsdata);
|
|
|
});
|
|
|
|
|
|
$(window).resize(function(){
|
|
|
graph.render(jsdata);
|
|
|
});
|
|
|
</script>
|
|
|
%else:
|
|
|
${_('There are no changes yet')}
|
|
|
%endif
|
|
|
</div>
|
|
|
</div>
|
|
|
</%def>
|
|
|
|