1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

Fix admin notice view-detail (#30450) (#30458)

Backport #30450 by @silverwind

Fix https://github.com/go-gitea/gitea/issues/30434, regression from
https://github.com/go-gitea/gitea/pull/30115.

I also removed the date insertion into the modal which was also broken
since that date was switched to `absolute-date` because I see no real
purpose to putting that date into the modal.

Result:

<img width="1038" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/aa2eb8b4-73dc-4d98-9b80-3f276f89d9e5">

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Giteabot 2024-04-13 16:49:44 +08:00 committed by GitHub
parent b941d7485b
commit fd2184e234
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 8 deletions

View File

@ -62,10 +62,7 @@
<div class="ui modal admin" id="detail-modal"> <div class="ui modal admin" id="detail-modal">
<div class="header">{{ctx.Locale.Tr "admin.notices.view_detail_header"}}</div> <div class="header">{{ctx.Locale.Tr "admin.notices.view_detail_header"}}</div>
<div class="content"> <div class="content"><pre></pre></div>
<div class="sub header"></div>
<pre></pre>
</div>
</div> </div>
{{template "admin/layout_footer" .}} {{template "admin/layout_footer" .}}

View File

@ -207,13 +207,13 @@ export function initAdminCommon() {
// Notice // Notice
if (document.querySelector('.admin.notice')) { if (document.querySelector('.admin.notice')) {
const $detailModal = document.getElementById('detail-modal'); const detailModal = document.getElementById('detail-modal');
// Attach view detail modals // Attach view detail modals
$('.view-detail').on('click', function () { $('.view-detail').on('click', function () {
$detailModal.find('.content pre').text($(this).parents('tr').find('.notice-description').text()); const description = this.closest('tr').querySelector('.notice-description').textContent;
$detailModal.find('.sub.header').text(this.closest('tr')?.querySelector('relative-time')?.getAttribute('title')); detailModal.querySelector('.content pre').textContent = description;
$detailModal.modal('show'); $(detailModal).modal('show');
return false; return false;
}); });