##// END OF EJS Templates
pull-requests: increase stability of concurrent pull requests creation by flushing prematurly the statuses of commits....
pull-requests: increase stability of concurrent pull requests creation by flushing prematurly the statuses of commits. This is required to increase the versions on each concurrent call. Otherwise we could get into an integrity errors of commitsha+version+repo

File last commit:

r3187:d9b9dddd default
r3408:2a133f7e stable
Show More
pullrequest_show.mako
845 lines | 40.1 KiB | application/x-mako | MakoHtmlLexer
templating: use .mako as extensions for template files.
r1282 <%inherit file="/base/base.mako"/>
pr-versioning: implemented versioning for pull requests....
r1368 <%namespace name="base" file="/base/base.mako"/>
pull-requests: allow markup rendered description.
r2816 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
templating: use .mako as extensions for template files.
r1282
<%def name="title()">
${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
%if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}
%endif
</%def>
<%def name="breadcrumbs_links()">
<span id="pr-title">
${c.pull_request.title}
%if c.pull_request.is_closed():
(${_('Closed')})
%endif
</span>
<div id="pr-title-edit" class="input" style="display: none;">
${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
</div>
</%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='repositories')}
</%def>
<%def name="menu_bar_subnav()">
${self.repo_menu(active='showpullrequest')}
</%def>
<%def name="main()">
html: fixed found syntax problems
r1283
templating: use .mako as extensions for template files.
r1282 <script type="text/javascript">
// TODO: marcink switch this to pyroutes
pull-requests: migrated code from pylons to pyramid
r1974 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
templating: use .mako as extensions for template files.
r1282 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
</script>
<div class="box">
comments: use unified aggregation of comments counters....
r1332
templating: use .mako as extensions for template files.
r1282 <div class="title">
${self.repo_page_title(c.rhodecode_db_repo)}
</div>
${self.breadcrumbs()}
<div class="box pr-summary">
comments: use unified aggregation of comments counters....
r1332
templating: use .mako as extensions for template files.
r1282 <div class="summary-details block-left">
html: fixed found syntax problems
r1283 <% summary = lambda n:{False:'summary-short'}.get(n) %>
templating: use .mako as extensions for template files.
r1282 <div class="pr-details-title">
pull-request: extended default reviewers functionality....
r1769 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)}
templating: use .mako as extensions for template files.
r1282 %if c.allowed_to_update:
<div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
% if c.allowed_to_delete:
forms: unified usage of h.secure_form. Make sure we ALWAYS pass in...
r2105 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)}
templating: use .mako as extensions for template files.
r1282 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
pull-request: extended default reviewers functionality....
r1769 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
templating: use .mako as extensions for template files.
r1282 ${h.end_form()}
% else:
${_('Delete')}
% endif
</div>
<div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
<div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
%endif
</div>
<div id="summary" class="fields pr-details-content">
<div class="field">
<div class="label-summary">
pull-request: extended default reviewers functionality....
r1769 <label>${_('Source')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="input">
<div class="pr-origininfo">
## branch link is only valid if it is a branch
<span class="tag">
%if c.pull_request.source_ref_parts.type == 'branch':
changelog: ported to pyramid views.
r1931 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
templating: use .mako as extensions for template files.
r1282 %else:
${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
%endif
</span>
<span class="clone-url">
repo-summary: re-implemented summary view as pyramid....
r1785 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
templating: use .mako as extensions for template files.
r1282 </span>
pull-requests: show common ancestor inside pull-request view....
r1594 <br/>
% if c.ancestor_commit:
${_('Common ancestor')}:
repo-commits: ported changeset code into pyramid views....
r1951 <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code>
pull-requests: show common ancestor inside pull-request view....
r1594 % endif
templating: use .mako as extensions for template files.
r1282 </div>
pull-requests: add copy helpers into pull requests clone/pull url inputs.
r1976 %if h.is_hg(c.pull_request.source_repo):
<% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
%elif h.is_git(c.pull_request.source_repo):
<% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
%endif
<div class="">
<input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
<i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
templating: use .mako as extensions for template files.
r1282 </div>
pull-requests: add copy helpers into pull requests clone/pull url inputs.
r1976
templating: use .mako as extensions for template files.
r1282 </div>
</div>
<div class="field">
<div class="label-summary">
<label>${_('Target')}:</label>
</div>
<div class="input">
<div class="pr-targetinfo">
## branch link is only valid if it is a branch
<span class="tag">
%if c.pull_request.target_ref_parts.type == 'branch':
changelog: ported to pyramid views.
r1931 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
templating: use .mako as extensions for template files.
r1282 %else:
${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
%endif
</span>
<span class="clone-url">
repo-summary: re-implemented summary view as pyramid....
r1785 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
templating: use .mako as extensions for template files.
r1282 </span>
</div>
</div>
</div>
## Link to the shadow repository.
<div class="field">
<div class="label-summary">
<label>${_('Merge')}:</label>
</div>
<div class="input">
% if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
%if h.is_hg(c.pull_request.target_repo):
pull-requests: add copy helpers into pull requests clone/pull url inputs.
r1976 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
templating: use .mako as extensions for template files.
r1282 %elif h.is_git(c.pull_request.target_repo):
pull-requests: add copy helpers into pull requests clone/pull url inputs.
r1976 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
templating: use .mako as extensions for template files.
r1282 %endif
pull-requests: add copy helpers into pull requests clone/pull url inputs.
r1976 <div class="">
<input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
<i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
</div>
templating: use .mako as extensions for template files.
r1282 % else:
pull-requests: add copy helpers into pull requests clone/pull url inputs.
r1976 <div class="">
${_('Shadow repository data not available')}.
</div>
templating: use .mako as extensions for template files.
r1282 % endif
</div>
</div>
<div class="field">
<div class="label-summary">
<label>${_('Review')}:</label>
</div>
<div class="input">
%if c.pull_request_review_status:
<div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
<span class="changeset-status-lbl tooltip">
%if c.pull_request.is_closed():
${_('Closed')},
%endif
${h.commit_status_lbl(c.pull_request_review_status)}
</span>
translation: unified usage of pluralize function ungettext....
r1945 - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
templating: use .mako as extensions for template files.
r1282 %endif
</div>
</div>
<div class="field">
pull-requests: make the renderer stored and saved for each pull requests....
r2903 <div class="pr-description-label label-summary" title="${_('Rendered using {} renderer').format(c.renderer)}">
templating: use .mako as extensions for template files.
r1282 <label>${_('Description')}:</label>
</div>
<div id="pr-desc" class="input">
pull-requests: make the renderer stored and saved for each pull requests....
r2903 <div class="pr-description">${h.render(c.pull_request.description, renderer=c.renderer)}</div>
templating: use .mako as extensions for template files.
r1282 </div>
<div id="pr-desc-edit" class="input textarea editor" style="display: none;">
pull-requests: make the renderer stored and saved for each pull requests....
r2903 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
pull-requests: allow markup rendered description.
r2816 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
templating: use .mako as extensions for template files.
r1282 </div>
</div>
<div class="field">
pr-versioning: implemented versioning for pull requests....
r1368 <div class="label-summary">
<label>${_('Versions')}:</label>
</div>
<% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
<% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
templating: use .mako as extensions for template files.
r1282
<div class="pr-versions">
% if c.show_version_changes:
pr-versioning: implemented versioning for pull requests....
r1368 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
<% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
pr-versioning: link-changes
r1369 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
translation: unified usage of pluralize function ungettext....
r1945 data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}"
pr-versioning: implemented versioning for pull requests....
r1368 data-toggle-off="${_('Hide all versions of this pull request')}">
translation: unified usage of pluralize function ungettext....
r1945 ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}
pr-versioning: link-changes
r1369 </a>
templating: use .mako as extensions for template files.
r1282 <table>
## SHOW ALL VERSIONS OF PR
<% ver_pr = None %>
comments: use unified aggregation of comments counters....
r1332
comments: properly show version of pull request into added comments....
r1286 % for data in reversed(list(enumerate(c.versions, 1))):
comments: use unified aggregation of comments counters....
r1332 <% ver_pos = data[0] %>
<% ver = data[1] %>
<% ver_pr = ver.pull_request_version_id %>
pr-versioning: implemented versioning for pull requests....
r1368 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
comments: properly show version of pull request into added comments....
r1286
pr-versioning: implemented versioning for pull requests....
r1368 <tr class="version-pr" style="display: ${display_row}">
<td>
<code>
pull-requests: migrated code from pylons to pyramid
r1974 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
pr-versioning: implemented versioning for pull requests....
r1368 </code>
</td>
comments: use unified aggregation of comments counters....
r1332 <td>
pr-versioning: implemented versioning for pull requests....
r1368 <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
<input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
</td>
<td>
<% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
<div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
</div>
</td>
<td>
% if c.at_version_num != ver_pr:
comments: use unified aggregation of comments counters....
r1332 <i class="icon-comment"></i>
pull-requests: show more info about version of comment vs latest version.
r2809 <code class="tooltip" title="${_('Comment from pull request version v{0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}">
pr-versioning: ux better selectors
r1370 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
comments: use unified aggregation of comments counters....
r1332 </code>
% endif
</td>
<td>
pr-versioning: implemented versioning for pull requests....
r1368 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
comments: use unified aggregation of comments counters....
r1332 </td>
<td>
pull-requests: show version age component should use local dates.
r1451 ${h.age_component(ver.updated_on, time_is_local=True)}
comments: use unified aggregation of comments counters....
r1332 </td>
</tr>
templating: use .mako as extensions for template files.
r1282 % endfor
<tr>
pr-versioning: ux better selectors
r1370 <td colspan="6">
<button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
data-label-text-locked="${_('select versions to show changes')}"
data-label-text-diff="${_('show changes between versions')}"
data-label-text-show="${_('show pull request for this version')}"
>
${_('select versions to show changes')}
pr-versioning: implemented versioning for pull requests....
r1368 </button>
templating: use .mako as extensions for template files.
r1282 </td>
pr-versioning: implemented versioning for pull requests....
r1368 </tr>
templating: use .mako as extensions for template files.
r1282
pr-versioning: implemented versioning for pull requests....
r1368 ## show comment/inline comments summary
<%def name="comments_summary()">
<tr>
<td colspan="6" class="comments-summary-td">
comments: use unified aggregation of comments counters....
r1332
% if c.at_version:
<% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
<% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
${_('Comments at this version')}:
% else:
<% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
<% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
${_('Comments for this pull request')}:
% endif
pr-versioning: implemented versioning for pull requests....
r1368
comments: use unified aggregation of comments counters....
r1332 %if general_comm_count_ver:
<a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
templating: use .mako as extensions for template files.
r1282 %else:
comments: use unified aggregation of comments counters....
r1332 ${_("%d General ") % general_comm_count_ver}
templating: use .mako as extensions for template files.
r1282 %endif
%if inline_comm_count_ver:
, <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
%else:
, ${_("%d Inline") % inline_comm_count_ver}
%endif
comments: use unified aggregation of comments counters....
r1332 %if outdated_comm_count_ver:
, <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
templating: use .mako as extensions for template files.
r1282 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
<a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
%else:
comments: use unified aggregation of comments counters....
r1332 , ${_("%d Outdated") % outdated_comm_count_ver}
templating: use .mako as extensions for template files.
r1282 %endif
</td>
</tr>
pr-versioning: implemented versioning for pull requests....
r1368 </%def>
${comments_summary()}
templating: use .mako as extensions for template files.
r1282 </table>
% else:
pr-versioning: implemented versioning for pull requests....
r1368 <div class="input">
templating: use .mako as extensions for template files.
r1282 ${_('Pull request versions not available')}.
pr-versioning: implemented versioning for pull requests....
r1368 </div>
<div>
<table>
${comments_summary()}
</table>
</div>
templating: use .mako as extensions for template files.
r1282 % endif
</div>
</div>
<div id="pr-save" class="field" style="display: none;">
<div class="label-summary"></div>
<div class="input">
pull-request: extended default reviewers functionality....
r1769 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
templating: use .mako as extensions for template files.
r1282 </div>
</div>
</div>
</div>
<div>
## AUTHOR
<div class="reviewers-title block-right">
<div class="pr-details-title">
pull-requests: expose author in creation view to be consistent with show view.
r1786 ${_('Author of this pull request')}
templating: use .mako as extensions for template files.
r1282 </div>
</div>
<div class="block-right pr-details-content reviewers">
<ul class="group_members">
<li>
${self.gravatar_with_user(c.pull_request.author.email, 16)}
</li>
</ul>
</div>
pull-request: extended default reviewers functionality....
r1769
## REVIEW RULES
<div id="review_rules" style="display: none" class="reviewers-title block-right">
<div class="pr-details-title">
${_('Reviewer rules')}
%if c.allowed_to_update:
<span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
%endif
</div>
<div class="pr-reviewer-rules">
## review rules will be appended here, by default reviewers logic
</div>
<input id="review_data" type="hidden" name="review_data" value="">
</div>
templating: use .mako as extensions for template files.
r1282 ## REVIEWERS
<div class="reviewers-title block-right">
<div class="pr-details-title">
default-reviewers: introduce new voting rule logic that allows...
r2484 ${_('Pull request reviewers')}
templating: use .mako as extensions for template files.
r1282 %if c.allowed_to_update:
pull-request: extended default reviewers functionality....
r1769 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
templating: use .mako as extensions for template files.
r1282 %endif
</div>
</div>
<div id="reviewers" class="block-right pr-details-content reviewers">
default-reviewers: introduce new voting rule logic that allows...
r2484
## members redering block
templating: use .mako as extensions for template files.
r1282 <input type="hidden" name="__start__" value="review_members:sequence">
<ul id="review_members" class="group_members">
default-reviewers: introduce new voting rule logic that allows...
r2484
% for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers:
<script>
var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n};
var status = "${(status[0][1].status if status else 'not_reviewed')}";
var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}";
var allowed_to_update = ${h.json.dumps(c.allowed_to_update)};
var entry = renderTemplate('reviewMemberEntry', {
'member': member,
'mandatory': member.mandatory,
'reasons': member.reasons,
'allowed_to_update': allowed_to_update,
'review_status': status,
'review_status_label': status_lbl,
default-reviewers: fixed edit mode when creating new entries.
r2504 'user_group': member.user_group,
'create': false
default-reviewers: introduce new voting rule logic that allows...
r2484 });
$('#review_members').append(entry)
</script>
% endfor
templating: use .mako as extensions for template files.
r1282 </ul>
<input type="hidden" name="__end__" value="review_members:sequence">
default-reviewers: introduce new voting rule logic that allows...
r2484 ## end members redering block
pull-request: extended default reviewers functionality....
r1769
%if not c.pull_request.is_closed():
<div id="add_reviewer" class="ac" style="display: none;">
%if c.allowed_to_update:
% if not c.forbid_adding_reviewers:
<div id="add_reviewer_input" class="reviewer_ac">
${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
<div id="reviewers_container"></div>
</div>
% endif
<div class="pull-right">
<button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
</div>
%endif
</div>
templating: use .mako as extensions for template files.
r1282 %endif
</div>
</div>
</div>
<div class="box">
##DIFF
<div class="table" >
<div id="changeset_compare_view_content">
##CS
% if c.missing_requirements:
<div class="box">
<div class="alert alert-warning">
<div>
<strong>${_('Missing requirements:')}</strong>
${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
</div>
</div>
</div>
% elif c.missing_commits:
<div class="box">
<div class="alert alert-warning">
<div>
<strong>${_('Missing commits')}:</strong>
${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
git: use force fetch and update for target ref. This solves a case...
r2784 ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n}
templating: use .mako as extensions for template files.
r1282 </div>
</div>
</div>
% endif
pr-versioning: implemented versioning for pull requests....
r1368
<div class="compare_view_commits_title">
% if not c.compare_mode:
% if c.at_version_pos:
<h4>
${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
</h4>
% endif
templating: use .mako as extensions for template files.
r1282
<div class="pull-left">
<div class="btn-group">
<a
class="btn"
href="#"
onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
translation: unified usage of pluralize function ungettext....
r1945 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
templating: use .mako as extensions for template files.
r1282 </a>
<a
class="btn"
href="#"
onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
translation: unified usage of pluralize function ungettext....
r1945 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
templating: use .mako as extensions for template files.
r1282 </a>
</div>
</div>
<div class="pull-right">
% if c.allowed_to_update and not c.pull_request.is_closed():
pull-request: extended default reviewers functionality....
r1769 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
templating: use .mako as extensions for template files.
r1282 % else:
<a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
% endif
</div>
pr-versioning: implemented versioning for pull requests....
r1368 % endif
</div>
pull-requests: fixed small UI issues in case of missing commits inside a Pull request.
r1287
templating: use .mako as extensions for template files.
r1282 % if not c.missing_commits:
pr-versioning: implemented versioning for pull requests....
r1368 % if c.compare_mode:
% if c.at_version:
<h4>
${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
</h4>
<div class="subtitle-compare">
${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
</div>
<div class="container">
<table class="rctable compare_view_commits">
<tr>
<th></th>
<th>${_('Time')}</th>
<th>${_('Author')}</th>
<th>${_('Commit')}</th>
<th></th>
<th>${_('Description')}</th>
</tr>
% for c_type, commit in c.commit_changes:
% if c_type in ['a', 'r']:
<%
if c_type == 'a':
cc_title = _('Commit added in displayed changes')
elif c_type == 'r':
cc_title = _('Commit removed in displayed changes')
else:
cc_title = ''
%>
<tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
<td>
<div class="commit-change-indicator color-${c_type}-border">
dan
tooltip: use consistent h.tooltip usage to set tooltips.
r1843 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
pr-versioning: implemented versioning for pull requests....
r1368 ${c_type.upper()}
</div>
</div>
</td>
<td class="td-time">
${h.age_component(commit.date)}
</td>
<td class="td-user">
${base.gravatar_with_user(commit.author, 16)}
</td>
<td class="td-hash">
<code>
repo-commits: ported changeset code into pyramid views....
r1951 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
core: stop using deprecated .revision
r3105 r${commit.idx}:${h.short_id(commit.raw_id)}
pr-versioning: implemented versioning for pull requests....
r1368 </a>
${h.hidden('revisions', commit.raw_id)}
</code>
</td>
commits: unified expand commit logic and UI....
r3187 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
icons: make expand icon same as before
r3168 <i class="icon-expand-linked"></i>
pr-versioning: implemented versioning for pull requests....
r1368 </td>
<td class="mid td-description">
<div class="log-container truncate-wrap">
commits: unified expand commit logic and UI....
r3187 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name)}</div>
pr-versioning: implemented versioning for pull requests....
r1368 </div>
</td>
</tr>
% endif
% endfor
</table>
</div>
% endif
% else:
<%include file="/compare/compare_commits.mako" />
% endif
html: fixed found syntax problems
r1283 <div class="cs_files">
pull-requests: fixed small UI issues in case of missing commits inside a Pull request.
r1287 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
pull-requests: allow to show range diff in pr view
r3124
${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on)}
% if c.range_diff_on:
% for commit in c.commit_ranges:
${cbdiffs.render_diffset(
c.changes[commit.raw_id],
commit=commit, use_comments=True,
collapse_when_files_over=5,
disable_new_comments=True,
deleted_files_comments=c.deleted_files_comments,
inline_comments=c.inline_comments)}
% endfor
% else:
${cbdiffs.render_diffset(
c.diffset, use_comments=True,
collapse_when_files_over=30,
disable_new_comments=not c.allowed_to_comment,
deleted_files_comments=c.deleted_files_comments,
inline_comments=c.inline_comments)}
% endif
pull-requests: fixed small UI issues in case of missing commits inside a Pull request.
r1287 </div>
% else:
## skipping commits we need to clear the view for missing commits
<div style="clear:both;"></div>
% endif
templating: use .mako as extensions for template files.
r1282
</div>
</div>
## template for inline comment form
<%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
## render general comments
comments: use unified aggregation of comments counters....
r1332
<div id="comment-tr-show">
<div class="comment">
pull-request: introduced new merge-checks....
r1334 % if general_outdated_comm_count_ver:
comments: use unified aggregation of comments counters....
r1332 <div class="meta">
pull-request: introduced new merge-checks....
r1334 % if general_outdated_comm_count_ver == 1:
${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
pr-versioning: link-changes
r1369 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
pull-request: introduced new merge-checks....
r1334 % else:
${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
pr-versioning: link-changes
r1369 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
comments: use unified aggregation of comments counters....
r1332 % endif
</div>
pull-request: introduced new merge-checks....
r1334 % endif
comments: use unified aggregation of comments counters....
r1332 </div>
</div>
${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
templating: use .mako as extensions for template files.
r1282
% if not c.pull_request.is_closed():
pull-request: introduced new merge-checks....
r1334 ## merge status, and merge action
<div class="pull-request-merge">
<%include file="/pullrequests/pullrequest_merge_checks.mako"/>
</div>
templating: use .mako as extensions for template files.
r1282 ## main comment form and it status
pull-requests: migrated code from pylons to pyramid
r1974 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
pull_request_id=c.pull_request.pull_request_id),
templating: use .mako as extensions for template files.
r1282 c.pull_request_review_status,
is_pull_request=True, change_status=c.allowed_to_change_status)}
%endif
<script type="text/javascript">
if (location.hash) {
var result = splitDelimitedHash(location.hash);
comments: use unified aggregation of comments counters....
r1332 var line = $('html').find(result.loc);
// show hidden comments if we use location.hash
if (line.hasClass('comment-general')) {
$(line).show();
} else if (line.hasClass('comment-inline')) {
$(line).show();
var $cb = $(line).closest('.cb');
$cb.removeClass('cb-collapsed')
}
templating: use .mako as extensions for template files.
r1282 if (line.length > 0){
offsetScroll(line, 70);
}
}
comments: use unified aggregation of comments counters....
r1332
pr-versioning: implemented versioning for pull requests....
r1368 versionController = new VersionController();
versionController.init();
pull-request: extended default reviewers functionality....
r1769 reviewersController = new ReviewersController();
commits: unified expand commit logic and UI....
r3187 commitsController = new CommitsController();
pr-versioning: implemented versioning for pull requests....
r1368
templating: use .mako as extensions for template files.
r1282 $(function(){
pull-request: extended default reviewers functionality....
r1769
templating: use .mako as extensions for template files.
r1282 // custom code mirror
pull-requests: allow markup rendered description.
r2816 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
templating: use .mako as extensions for template files.
r1282
var PRDetails = {
editButton: $('#open_edit_pullrequest'),
closeButton: $('#close_edit_pullrequest'),
deleteButton: $('#delete_pullrequest'),
viewFields: $('#pr-desc, #pr-title'),
editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
init: function() {
var that = this;
this.editButton.on('click', function(e) { that.edit(); });
this.closeButton.on('click', function(e) { that.view(); });
},
edit: function(event) {
this.viewFields.hide();
this.editButton.hide();
this.deleteButton.hide();
this.closeButton.show();
this.editFields.show();
codeMirrorInstance.refresh();
},
view: function(event) {
this.editButton.show();
this.deleteButton.show();
this.editFields.hide();
this.closeButton.hide();
this.viewFields.show();
}
};
var ReviewersPanel = {
editButton: $('#open_edit_reviewers'),
closeButton: $('#close_edit_reviewers'),
pull-request: extended default reviewers functionality....
r1769 addButton: $('#add_reviewer'),
default-reviewers: introduce new voting rule logic that allows...
r2484 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'),
templating: use .mako as extensions for template files.
r1282
init: function() {
pull-request: extended default reviewers functionality....
r1769 var self = this;
this.editButton.on('click', function(e) { self.edit(); });
this.closeButton.on('click', function(e) { self.close(); });
templating: use .mako as extensions for template files.
r1282 },
edit: function(event) {
this.editButton.hide();
this.closeButton.show();
this.addButton.show();
this.removeButtons.css('visibility', 'visible');
pull-request: extended default reviewers functionality....
r1769 // review rules
reviewersController.loadReviewRules(
${c.pull_request.reviewer_data_json | n});
templating: use .mako as extensions for template files.
r1282 },
close: function(event) {
this.editButton.show();
this.closeButton.hide();
this.addButton.hide();
this.removeButtons.css('visibility', 'hidden');
pull-request: extended default reviewers functionality....
r1769 // hide review rules
reviewersController.hideReviewRules()
templating: use .mako as extensions for template files.
r1282 }
};
PRDetails.init();
ReviewersPanel.init();
showOutdated = function(self){
comments: use unified aggregation of comments counters....
r1332 $('.comment-inline.comment-outdated').show();
templating: use .mako as extensions for template files.
r1282 $('.filediff-outdated').show();
$('.showOutdatedComments').hide();
$('.hideOutdatedComments').show();
};
hideOutdated = function(self){
comments: use unified aggregation of comments counters....
r1332 $('.comment-inline.comment-outdated').hide();
templating: use .mako as extensions for template files.
r1282 $('.filediff-outdated').hide();
$('.hideOutdatedComments').hide();
$('.showOutdatedComments').show();
};
pull-request: introduced new merge-checks....
r1334 refreshMergeChecks = function(){
pull-requests: migrated code from pylons to pyramid
r1974 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
pull-request: introduced new merge-checks....
r1334 $('.pull-request-merge').css('opacity', 0.3);
pull-requests: add explicit CLOSE pr action instead of closed status from selector....
r1445 $('.action-buttons-extra').css('opacity', 0.3);
pull-request: introduced new merge-checks....
r1334 $('.pull-request-merge').load(
pull-requests: add explicit CLOSE pr action instead of closed status from selector....
r1445 loadUrl, function() {
pull-request: introduced new merge-checks....
r1334 $('.pull-request-merge').css('opacity', 1);
pull-requests: add explicit CLOSE pr action instead of closed status from selector....
r1445
$('.action-buttons-extra').css('opacity', 1);
injectCloseAction();
pull-request: introduced new merge-checks....
r1334 }
);
};
pull-requests: add explicit CLOSE pr action instead of closed status from selector....
r1445 injectCloseAction = function() {
var closeAction = $('#close-pull-request-action').html();
var $actionButtons = $('.action-buttons-extra');
// clear the action before
$actionButtons.html("");
$actionButtons.html(closeAction);
};
closePullRequest = function (status) {
// inject closing flag
$('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
$(generalCommentForm.statusChange).select2("val", status).trigger('change');
$(generalCommentForm.submitForm).submit();
};
templating: use .mako as extensions for template files.
r1282 $('#show-outdated-comments').on('click', function(e){
var button = $(this);
var outdated = $('.comment-outdated');
if (button.html() === "(Show)") {
button.html("(Hide)");
outdated.show();
} else {
button.html("(Show)");
outdated.hide();
}
});
$('.show-inline-comments').on('change', function(e){
var show = 'none';
var target = e.currentTarget;
if(target.checked){
show = ''
}
var boxid = $(target).attr('id_for');
var comments = $('#{0} .inline-comments'.format(boxid));
var fn_display = function(idx){
$(this).css('display', show);
};
$(comments).each(fn_display);
var btns = $('#{0} .inline-comments-button'.format(boxid));
$(btns).each(fn_display);
});
$('#merge_pull_request_form').submit(function() {
if (!$('#merge_pull_request').attr('disabled')) {
$('#merge_pull_request').attr('disabled', 'disabled');
}
return true;
});
$('#edit_pull_request').on('click', function(e){
var title = $('#pr-title-input').val();
var description = codeMirrorInstance.getValue();
pull-requests: make the renderer stored and saved for each pull requests....
r2903 var renderer = $('#pr-renderer-input').val();
templating: use .mako as extensions for template files.
r1282 editPullRequest(
"${c.repo_name}", "${c.pull_request.pull_request_id}",
pull-requests: make the renderer stored and saved for each pull requests....
r2903 title, description, renderer);
templating: use .mako as extensions for template files.
r1282 });
$('#update_pull_request').on('click', function(e){
pull-request: lock button when updating reviewers to forbid multi-submit....
r1578 $(this).attr('disabled', 'disabled');
$(this).addClass('disabled');
pull-request: force update pull-request in case of the target repo reference changes....
r1595 $(this).html(_gettext('Saving...'));
pull-request: extended default reviewers functionality....
r1769 reviewersController.updateReviewers(
"${c.repo_name}", "${c.pull_request.pull_request_id}");
templating: use .mako as extensions for template files.
r1282 });
$('#update_commits').on('click', function(e){
var isDisabled = !$(e.currentTarget).attr('disabled');
pull-request: force update pull-request in case of the target repo reference changes....
r1595 $(e.currentTarget).attr('disabled', 'disabled');
$(e.currentTarget).addClass('disabled');
$(e.currentTarget).removeClass('btn-primary');
templating: use .mako as extensions for template files.
r1282 $(e.currentTarget).text(_gettext('Updating...'));
if(isDisabled){
pull-request: extended default reviewers functionality....
r1769 updateCommits(
"${c.repo_name}", "${c.pull_request.pull_request_id}");
templating: use .mako as extensions for template files.
r1282 }
});
// fixing issue with caches on firefox
$('#update_commits').removeAttr("disabled");
$('.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");
}
});
pull-request: introduced new merge-checks....
r1334
// register submit callback on commentForm form to track TODOs
window.commentFormGlobalSubmitSuccessCallback = function(){
refreshMergeChecks();
};
pull-requests: add explicit CLOSE pr action instead of closed status from selector....
r1445 // initial injection
injectCloseAction();
pull-request: introduced new merge-checks....
r1334
pull-request: extended default reviewers functionality....
r1769 ReviewerAutoComplete('#user');
templating: use .mako as extensions for template files.
r1282 })
</script>
</div>
</div>
</%def>