feature: makes forks and PR's link to clearly show admin what will be done

This commit is contained in:
ievgenii vdovenko 2025-07-31 15:14:23 +02:00
parent 03fc3ab570
commit d392589e5c
8 changed files with 92 additions and 83 deletions

View file

@ -200,21 +200,19 @@
<div class="panel-body">
${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), request=request)}
<table class="display">
<% forks = c.rhodecode_db_repo.forks.count() %>
<% forks = len(c.fork_links) %>
<% delete_forks = c.rhodecode_db_repo.private %>
% if forks:
<tr>
<td>
${_ungettext('This repository has %s fork.', 'This repository has %s forks.', forks) % forks}
<td class="alert-${'error' if delete_forks else 'warning'}" style="padding: 10px">
${_ungettext('Following fork will be %s:', 'Following forks will be %s:', forks) % ('deleted' if delete_forks else 'detached')}
</td>
<td>
%if forks:
<input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
%endif
</td>
<td>
%if forks:
<input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
%endif
<ul>
% for fork in c.fork_links:
<li class="list-unstyled"><a href="${fork}" target="_blank" rel="noopener noreferrer">${fork.replace("/", "")} <span aria-hidden="true" style="font-size: 0.9em;">↗️</span></a></li>
% endfor
</ul>
</td>
</tr>
% endif
@ -222,8 +220,10 @@
<% attached_prs = len(c.rhodecode_db_repo.pull_requests_source + c.rhodecode_db_repo.pull_requests_target) %>
% if attached_prs:
<tr>
<td colspan="3">
${_ungettext('This repository has %s attached pull request.', 'This repository has %s attached pull requests.', attached_prs) % attached_prs}
<td colspan="2" style="padding: 10px">
<a href="${c.pr_link}" target="_blank" rel="noopener noreferrer">
${_ungettext('This repository has %s attached pull request (open/close).', 'This repository has %s attached pull requests (open/close).', attached_prs) % attached_prs} <span aria-hidden="true" style="font-size: 0.9em;">↗️</span>
</a>
</td>
</tr>
% endif
@ -231,23 +231,11 @@
<% attached_artifacts = len(c.rhodecode_db_repo.artifacts) %>
% if attached_artifacts:
<tr>
<td colspan="3">
<td colspan="2">
${_ungettext('This repository has %s attached artifact.', 'This repository has %s attached artifacts.', attached_artifacts) % attached_artifacts}
</td>
</tr>
% endif
<tr>
<td colspan="3">
% if attached_artifacts or attached_prs or forks:
<br/>
<br/>
% endif
<span class="alert-warning" style="padding: 10px">
<strong>${_('Warning: You are about to delete the repository. This action cannot be undone!')}</strong>
</span>
</td>
</tr>
</table>
<div style="margin: 0 0 20px 0" class="fake-space"></div>