changeset.mako
356 lines
| 15.6 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.mako"/> | ||||
<%namespace name="diff_block" file="/changeset/diff_block.mako"/> | ||||
<%def name="title()"> | ||||
${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)} | ||||
%if c.rhodecode_name: | ||||
· ${h.branding(c.rhodecode_name)} | ||||
%endif | ||||
</%def> | ||||
<%def name="menu_bar_nav()"> | ||||
${self.menu_items(active='repositories')} | ||||
</%def> | ||||
<%def name="menu_bar_subnav()"> | ||||
r3742 | ${self.repo_menu(active='commits')} | |||
r1282 | </%def> | |||
<%def name="main()"> | ||||
<script> | ||||
// TODO: marcink switch this to pyroutes | ||||
r1951 | AJAX_COMMENT_DELETE_URL = "${h.route_path('repo_commit_comment_delete',repo_name=c.repo_name,commit_id=c.commit.raw_id,comment_id='__COMMENT_ID__')}"; | |||
r1282 | templateContext.commit_data.commit_id = "${c.commit.raw_id}"; | |||
</script> | ||||
<div class="box"> | ||||
<div id="changeset_compare_view_content" class="summary changeset"> | ||||
<div class="summary-detail"> | ||||
Liviu
|
r3685 | <div class="fieldset"> | ||
<div class="left-label-summary"> | ||||
<p>${_('Commit')}</p> | ||||
<div class="right-label-summary"> | ||||
<code> | ||||
${h.show_id(c.commit)} | ||||
</code> | ||||
<i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.commit.raw_id}" title="${_('Copy the full commit id')}"></i> | ||||
% if hasattr(c.commit, 'phase'): | ||||
<span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span> | ||||
% endif | ||||
r2129 | ||||
Liviu
|
r3685 | ## obsolete commits | ||
% if hasattr(c.commit, 'obsolete'): | ||||
% if c.commit.obsolete: | ||||
<span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span> | ||||
% endif | ||||
r2129 | % endif | |||
r1738 | ||||
Liviu
|
r3685 | ## hidden commits | ||
% if hasattr(c.commit, 'hidden'): | ||||
% if c.commit.hidden: | ||||
<span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span> | ||||
% endif | ||||
r2129 | % endif | |||
Liviu
|
r3685 | |||
r1738 | ||||
Liviu
|
r3685 | <div class="pull-right"> | ||
<span id="parent_link"> | ||||
<a href="#parentCommit" title="${_('Parent Commit')}"><i class="icon-left icon-no-margin"></i>${_('parent')}</a> | ||||
</span> | ||||
| | ||||
<span id="child_link"> | ||||
<a href="#childCommit" title="${_('Child Commit')}">${_('child')}<i class="icon-right icon-no-margin"></i></a> | ||||
</span> | ||||
</div> | ||||
</div> | ||||
</div> | ||||
r2129 | </div> | |||
Liviu
|
r3685 | |||
r1282 | ||||
<div class="fieldset"> | ||||
Liviu
|
r3685 | <div class="left-label-summary"> | ||
<p>${_('Description')}:</p> | ||||
<div class="right-label-summary"> | ||||
<div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div> | ||||
<div id="message_expand" style="display:none;"> | ||||
${_('Expand')} | ||||
</div> | ||||
r1282 | </div> | |||
</div> | ||||
</div> | ||||
%if c.statuses: | ||||
<div class="fieldset"> | ||||
Liviu
|
r3685 | <div class="left-label-summary"> | ||
<p>${_('Commit status')}:</p> | ||||
<div class="right-label-summary"> | ||||
<div class="changeset-status-ico"> | ||||
<div class="${'flag_status %s' % c.statuses[0]} pull-left"></div> | ||||
</div> | ||||
<div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div> | ||||
r1282 | </div> | |||
</div> | ||||
</div> | ||||
%endif | ||||
<div class="fieldset"> | ||||
Liviu
|
r3685 | <div class="left-label-summary"> | ||
<p>${_('References')}:</p> | ||||
<div class="right-label-summary"> | ||||
<div class="tags"> | ||||
%if c.commit.merge: | ||||
<span class="mergetag tag"> | ||||
<i class="icon-merge"></i>${_('merge')} | ||||
</span> | ||||
%endif | ||||
r1282 | ||||
Liviu
|
r3685 | %if h.is_hg(c.rhodecode_repo): | ||
%for book in c.commit.bookmarks: | ||||
<span class="booktag tag" title="${h.tooltip(_('Bookmark %s') % book)}"> | ||||
<a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a> | ||||
</span> | ||||
%endfor | ||||
%endif | ||||
r1282 | ||||
Liviu
|
r3685 | %for tag in c.commit.tags: | ||
<span class="tagtag tag" title="${h.tooltip(_('Tag %s') % tag)}"> | ||||
<a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a> | ||||
</span> | ||||
%endfor | ||||
r1282 | ||||
Liviu
|
r3685 | %if c.commit.branch: | ||
<span class="branchtag tag" title="${h.tooltip(_('Branch %s') % c.commit.branch)}"> | ||||
<a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=c.commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a> | ||||
</span> | ||||
%endif | ||||
</div> | ||||
r1282 | </div> | |||
</div> | ||||
Liviu
|
r3685 | </div> | ||
r1282 | ||||
<div class="fieldset"> | ||||
Liviu
|
r3685 | <div class="left-label-summary"> | ||
<p>${_('Diff options')}:</p> | ||||
<div class="right-label-summary"> | ||||
r1282 | <div class="diff-actions"> | |||
r1951 | <a href="${h.route_path('repo_commit_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}"> | |||
r1282 | ${_('Raw Diff')} | |||
</a> | ||||
| | ||||
r1951 | <a href="${h.route_path('repo_commit_patch',repo_name=c.repo_name,commit_id=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}"> | |||
r1282 | ${_('Patch Diff')} | |||
</a> | ||||
| | ||||
r1951 | <a href="${h.route_path('repo_commit_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(diff='download'))}" class="tooltip" title="${h.tooltip(_('Download diff'))}"> | |||
r1282 | ${_('Download Diff')} | |||
</a> | ||||
</div> | ||||
Liviu
|
r3685 | </div> | ||
r1282 | </div> | |||
</div> | ||||
<div class="fieldset"> | ||||
Liviu
|
r3685 | <div class="left-label-summary"> | ||
<p>${_('Comments')}:</p> | ||||
<div class="right-label-summary"> | ||||
r1282 | <div class="comments-number"> | |||
%if c.comments: | ||||
r1945 | <a href="#comments">${_ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>, | |||
r1282 | %else: | |||
r1945 | ${_ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)} | |||
r1282 | %endif | |||
%if c.inline_cnt: | ||||
r1945 | <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a> | |||
r1282 | %else: | |||
r1945 | ${_ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt} | |||
r1282 | %endif | |||
</div> | ||||
Liviu
|
r3685 | </div> | ||
r1282 | </div> | |||
</div> | ||||
r1385 | <div class="fieldset"> | |||
Liviu
|
r3685 | <div class="left-label-summary"> | ||
<p>${_('Unresolved TODOs')}:</p> | ||||
<div class="right-label-summary"> | ||||
<div class="comments-number"> | ||||
% if c.unresolved_comments: | ||||
% for co in c.unresolved_comments: | ||||
<a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','} | ||||
% endfor | ||||
% else: | ||||
${_('There are no unresolved TODOs')} | ||||
% endif | ||||
</div> | ||||
</div> | ||||
r1385 | </div> | |||
</div> | ||||
Liviu
|
r3685 | <div class="fieldset"> | ||
<div class="left-label-summary"> | ||||
<p>${_('Author')}</p> | ||||
r1282 | ||||
Liviu
|
r3685 | <div class="right-label-summary"> | ||
r1282 | ${self.gravatar_with_user(c.commit.author)} | |||
<div class="user-inline-data">- ${h.age_component(c.commit.date)}</div> | ||||
Liviu
|
r3685 | </div> | ||
r1282 | </div> | |||
Liviu
|
r3685 | |||
<div class="clear-fix"></div> | ||||
</div> <!-- end summary-detail --> | ||||
r1282 | </div> <!-- end summary --> | |||
Liviu
|
r3685 | </div> | ||
r1282 | <div class="cs_files"> | |||
<%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> | ||||
r3100 | ${cbdiffs.render_diffset_menu(c.changes[c.commit.raw_id])} | |||
r1282 | ${cbdiffs.render_diffset( | |||
Bartłomiej Wołyńczyk
|
r2685 | c.changes[c.commit.raw_id], commit=c.commit, use_comments=True,inline_comments=c.inline_comments )} | ||
r1282 | </div> | |||
## template for inline comment form | ||||
<%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> | ||||
## render comments | ||||
r1332 | ${comment.generate_comments(c.comments)} | |||
r1282 | ||||
## main comment form and it status | ||||
r1951 | ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id=c.commit.raw_id), | |||
r1282 | h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))} | |||
</div> | ||||
## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS | ||||
<script type="text/javascript"> | ||||
$(document).ready(function() { | ||||
var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10); | ||||
if($('#trimmed_message_box').height() === boxmax){ | ||||
$('#message_expand').show(); | ||||
} | ||||
$('#message_expand').on('click', function(e){ | ||||
$('#trimmed_message_box').css('max-height', 'none'); | ||||
$(this).hide(); | ||||
}); | ||||
$('.show-inline-comments').on('click', function(e){ | ||||
var boxid = $(this).attr('data-comment-id'); | ||||
var button = $(this); | ||||
if(button.hasClass("comments-visible")) { | ||||
$('#{0} .inline-comments'.format(boxid)).each(function(index){ | ||||
$(this).hide(); | ||||
}); | ||||
button.removeClass("comments-visible"); | ||||
} else { | ||||
$('#{0} .inline-comments'.format(boxid)).each(function(index){ | ||||
$(this).show(); | ||||
}); | ||||
button.addClass("comments-visible"); | ||||
} | ||||
}); | ||||
// next links | ||||
$('#child_link').on('click', function(e){ | ||||
// fetch via ajax what is going to be the next link, if we have | ||||
// >1 links show them to user to choose | ||||
if(!$('#child_link').hasClass('disabled')){ | ||||
$.ajax({ | ||||
r1951 | url: '${h.route_path('repo_commit_children',repo_name=c.repo_name, commit_id=c.commit.raw_id)}', | |||
r1282 | success: function(data) { | |||
if(data.results.length === 0){ | ||||
$('#child_link').html("${_('No Child Commits')}").addClass('disabled'); | ||||
} | ||||
if(data.results.length === 1){ | ||||
var commit = data.results[0]; | ||||
r1951 | window.location = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': commit.raw_id}); | |||
r1282 | } | |||
else if(data.results.length === 2){ | ||||
$('#child_link').addClass('disabled'); | ||||
$('#child_link').addClass('double'); | ||||
r3852 | ||||
r1282 | var _html = ''; | |||
r3852 | _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a> ' | |||
.replace('__branch__', data.results[0].branch) | ||||
r1282 | .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6))) | |||
.replace('__title__', data.results[0].message) | ||||
r1951 | .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[0].raw_id})); | |||
r1283 | _html +=' | '; | |||
r3852 | _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a> ' | |||
.replace('__branch__', data.results[1].branch) | ||||
r1282 | .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6))) | |||
.replace('__title__', data.results[1].message) | ||||
r1951 | .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[1].raw_id})); | |||
r1282 | $('#child_link').html(_html); | |||
} | ||||
} | ||||
}); | ||||
e.preventDefault(); | ||||
} | ||||
}); | ||||
// prev links | ||||
$('#parent_link').on('click', function(e){ | ||||
// fetch via ajax what is going to be the next link, if we have | ||||
// >1 links show them to user to choose | ||||
if(!$('#parent_link').hasClass('disabled')){ | ||||
$.ajax({ | ||||
r1951 | url: '${h.route_path("repo_commit_parents",repo_name=c.repo_name, commit_id=c.commit.raw_id)}', | |||
r1282 | success: function(data) { | |||
if(data.results.length === 0){ | ||||
$('#parent_link').html('${_('No Parent Commits')}').addClass('disabled'); | ||||
} | ||||
if(data.results.length === 1){ | ||||
var commit = data.results[0]; | ||||
r1951 | window.location = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': commit.raw_id}); | |||
r1282 | } | |||
else if(data.results.length === 2){ | ||||
$('#parent_link').addClass('disabled'); | ||||
$('#parent_link').addClass('double'); | ||||
r3852 | ||||
r1282 | var _html = ''; | |||
r3852 | _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a>' | |||
.replace('__branch__', data.results[0].branch) | ||||
r1282 | .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6))) | |||
.replace('__title__', data.results[0].message) | ||||
r1951 | .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[0].raw_id})); | |||
r1283 | _html +=' | '; | |||
r3852 | _html +='<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a>' | |||
.replace('__branch__', data.results[1].branch) | ||||
r1282 | .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6))) | |||
.replace('__title__', data.results[1].message) | ||||
r1951 | .replace('__url__', pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}','commit_id': data.results[1].raw_id})); | |||
r1282 | $('#parent_link').html(_html); | |||
} | ||||
} | ||||
}); | ||||
e.preventDefault(); | ||||
} | ||||
}); | ||||
if (location.hash) { | ||||
var result = splitDelimitedHash(location.hash); | ||||
var line = $('html').find(result.loc); | ||||
if (line.length > 0){ | ||||
offsetScroll(line, 70); | ||||
} | ||||
} | ||||
// browse tree @ revision | ||||
$('#files_link').on('click', function(e){ | ||||
r1927 | window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}'; | |||
r1282 | e.preventDefault(); | |||
}); | ||||
// inject comments into their proper positions | ||||
var file_comments = $('.inline-comment-placeholder'); | ||||
}) | ||||
</script> | ||||
</%def> | ||||