Skip to content

Commit 5e68a90

Browse files
silverwindGiteaBot
authored andcommitted
Fix admin notice view-detail (go-gitea#30450)
Fix go-gitea#30434, regression from go-gitea#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">
1 parent b941d74 commit 5e68a90

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

templates/admin/notice.tmpl

+1-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@
6262

6363
<div class="ui modal admin" id="detail-modal">
6464
<div class="header">{{ctx.Locale.Tr "admin.notices.view_detail_header"}}</div>
65-
<div class="content">
66-
<div class="sub header"></div>
67-
<pre></pre>
68-
</div>
65+
<div class="content"><pre></pre></div>
6966
</div>
7067

7168
{{template "admin/layout_footer" .}}

web_src/js/features/admin/common.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ export function initAdminCommon() {
207207

208208
// Notice
209209
if (document.querySelector('.admin.notice')) {
210-
const $detailModal = document.getElementById('detail-modal');
210+
const detailModal = document.getElementById('detail-modal');
211211

212212
// Attach view detail modals
213213
$('.view-detail').on('click', function () {
214-
$detailModal.find('.content pre').text($(this).parents('tr').find('.notice-description').text());
215-
$detailModal.find('.sub.header').text(this.closest('tr')?.querySelector('relative-time')?.getAttribute('title'));
216-
$detailModal.modal('show');
214+
const description = this.closest('tr').querySelector('.notice-description').textContent;
215+
detailModal.querySelector('.content pre').textContent = description;
216+
$(detailModal).modal('show');
217217
return false;
218218
});
219219

0 commit comments

Comments
 (0)